BLOCKING_QUEUE: don't forget to cleanup if we try_push()

This commit is contained in:
vsonnier 2017-02-15 20:27:57 +01:00
parent 65c1722bca
commit 3ed65eff8e

View File

@ -298,13 +298,17 @@ void DemodulatorThread::run() {
ati_vis->type = 0; ati_vis->type = 0;
} }
//non-blocking push for audio-out if (!localAudioVisOutputQueue->try_push(ati_vis)) {
localAudioVisOutputQueue->try_push(ati_vis); //non-blocking push for audio-out
ati_vis->setRefCount(0);
std::cout << "DemodulatorThread::run() cannot push ati_vis into localAudioVisOutputQueue, is full !" << std::endl;
std::this_thread::yield();
}
} }
if (ati != nullptr) { if (ati != nullptr) {
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator()))) { if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator()))) {
//non-blocking push for audio-out
audioOutputQueue->push(ati); audioOutputQueue->push(ati);
} else { } else {
ati->setRefCount(0); ati->setRefCount(0);