mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-07 16:34:50 -04:00
Use the nuclear option to solve the hung problem:
Besides deadlocks, a thread can in theory get stuck in a blocking pop(), not seeing the stopping flag in particular. So assure liveness by making all pop() timed pop.
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
//50 ms
|
||||
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
|
||||
|
||||
SDRPostThread::SDRPostThread() : IOThread(), buffers("SDRPostThreadBuffers"), visualDataBuffers("SDRPostThreadVisualDataBuffers"), frequency(0) {
|
||||
iqDataInQueue = NULL;
|
||||
iqDataOutQueue = NULL;
|
||||
@@ -185,7 +188,9 @@ void SDRPostThread::run() {
|
||||
while (!stopping) {
|
||||
SDRThreadIQDataPtr data_in;
|
||||
|
||||
iqDataInQueue->pop(data_in);
|
||||
if (!iqDataInQueue->pop(data_in, HEARTBEAT_CHECK_PERIOD_MICROS)) {
|
||||
continue;
|
||||
}
|
||||
// std::lock_guard < std::mutex > lock(data_in->m_mutex);
|
||||
|
||||
std::lock_guard < std::mutex > lock(busy_demod);
|
||||
|
||||
Reference in New Issue
Block a user