mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-05 14:47:52 -04:00
Attempt to clean up any buffers that weren't used on terminate, still one hanging around..
This commit is contained in:
parent
389ac4f537
commit
50bfb251f8
@ -421,6 +421,14 @@ void AudioThread::terminate() {
|
|||||||
terminated = true;
|
terminated = true;
|
||||||
AudioThreadCommand endCond; // push an empty input to bump the queue
|
AudioThreadCommand endCond; // push an empty input to bump the queue
|
||||||
cmdQueue.push(endCond);
|
cmdQueue.push(endCond);
|
||||||
|
|
||||||
|
while (!inputQueue->empty()) { // flush queue
|
||||||
|
AudioThreadInput *dummy;
|
||||||
|
inputQueue->pop(dummy);
|
||||||
|
if (dummy) {
|
||||||
|
dummy->decRefCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioThread::isActive() {
|
bool AudioThread::isActive() {
|
||||||
|
@ -271,6 +271,11 @@ void DemodulatorPreThread::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!iqOutputQueue->empty()) {
|
||||||
|
DemodulatorThreadPostIQData *tmp;
|
||||||
|
iqOutputQueue->pop(tmp);
|
||||||
|
tmp->decRefCount();
|
||||||
|
}
|
||||||
buffers.purge();
|
buffers.purge();
|
||||||
|
|
||||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
||||||
|
@ -277,6 +277,17 @@ void DemodulatorThread::run() {
|
|||||||
}
|
}
|
||||||
// end while !terminated
|
// end while !terminated
|
||||||
|
|
||||||
|
// Purge any unused inputs
|
||||||
|
while (!iqInputQueue->empty()) {
|
||||||
|
DemodulatorThreadPostIQData *inp;
|
||||||
|
iqInputQueue->pop(inp);
|
||||||
|
inp->setRefCount(0);
|
||||||
|
}
|
||||||
|
while (!audioOutputQueue->empty()) {
|
||||||
|
AudioThreadInput *ati;
|
||||||
|
audioOutputQueue->pop(ati);
|
||||||
|
ati->setRefCount(0);
|
||||||
|
}
|
||||||
outputBuffers.purge();
|
outputBuffers.purge();
|
||||||
|
|
||||||
//Guard the cleanup of audioVisOutputQueue properly.
|
//Guard the cleanup of audioVisOutputQueue properly.
|
||||||
|
@ -231,8 +231,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Remove any items in the queue.
|
* Remove any items in the queue.
|
||||||
*/
|
*/
|
||||||
void flush() const {
|
void flush() {
|
||||||
std::lock_guard < std::mutex > lock(m_mutex);
|
std::lock_guard < std::mutex > lock(m_mutex);
|
||||||
|
m_queue = std::queue<T, Container>();
|
||||||
std::queue<T, Container> emptyQueue;
|
std::queue<T, Container> emptyQueue;
|
||||||
std::swap(m_queue, emptyQueue);
|
std::swap(m_queue, emptyQueue);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user