Trying.. still one stuck in the queue on delete..

This commit is contained in:
Charles J. Cliffe 2016-06-07 21:12:30 -04:00
parent 50bfb251f8
commit 2bdefca263
2 changed files with 19 additions and 20 deletions

View File

@ -409,6 +409,14 @@ void AudioThread::run() {
}
}
while (!inputQueue->empty()) { // flush queue
AudioThreadInput *dummy;
inputQueue->pop(dummy);
if (dummy) {
dummy->setRefCount(0);
}
}
if (threadQueueNotify != NULL) {
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED);
tCmd.context = this;
@ -421,14 +429,6 @@ void AudioThread::terminate() {
terminated = true;
AudioThreadCommand endCond; // push an empty input to bump the queue
cmdQueue.push(endCond);
while (!inputQueue->empty()) { // flush queue
AudioThreadInput *dummy;
inputQueue->pop(dummy);
if (dummy) {
dummy->decRefCount();
}
}
}
bool AudioThread::isActive() {

View File

@ -173,7 +173,7 @@ void DemodulatorThread::run() {
}
}
} else if (ati) {
ati->decRefCount();
ati->setRefCount(0);
ati = nullptr;
}
@ -279,24 +279,23 @@ void DemodulatorThread::run() {
// Purge any unused inputs
while (!iqInputQueue->empty()) {
DemodulatorThreadPostIQData *inp;
iqInputQueue->pop(inp);
inp->setRefCount(0);
DemodulatorThreadPostIQData *ref;
iqInputQueue->pop(ref);
if (ref) {
ref->setRefCount(0);
}
}
while (!audioOutputQueue->empty()) {
AudioThreadInput *ati;
audioOutputQueue->pop(ati);
ati->setRefCount(0);
AudioThreadInput *ref;
audioOutputQueue->pop(ref);
if (ref) {
ref->setRefCount(0);
}
}
outputBuffers.purge();
//Guard the cleanup of audioVisOutputQueue properly.
std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue);
// if (audioVisOutputQueue != nullptr && !audioVisOutputQueue->empty()) {
// AudioThreadInput *dummy_vis;
// audioVisOutputQueue->pop(dummy_vis);
// }
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
tCmd.context = this;