mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 21:58:37 -05:00
Make IOThreads terminate() fully non-blocking and misc.
- Thanks to timed-pop() usage, it is no longer needed to nudge queues with dummy to wake them - Less bad luck to be stuck there - Misc: leave the trace about the audio thread staturation, useful despite it raises some alarm among users...
This commit is contained in:
parent
acc6d2a31d
commit
e32e687fe8
@ -476,9 +476,6 @@ void AudioThread::run() {
|
||||
|
||||
void AudioThread::terminate() {
|
||||
IOThread::terminate();
|
||||
AudioThreadCommand endCond; // push an empty input to bump the queue
|
||||
//VSO: blocking push
|
||||
cmdQueue.push(endCond);
|
||||
}
|
||||
|
||||
bool AudioThread::isActive() {
|
||||
|
@ -348,18 +348,10 @@ int DemodulatorPreThread::getAudioSampleRate() {
|
||||
|
||||
void DemodulatorPreThread::terminate() {
|
||||
|
||||
//make non-blocking calls to be sure threads are flagged for termination before attempting the blocking calls.
|
||||
//make non-blocking calls to be sure threads are flagged for termination.
|
||||
IOThread::terminate();
|
||||
workerThread->terminate();
|
||||
|
||||
DemodulatorThreadIQDataPtr inp(new DemodulatorThreadIQData); // push dummy to nudge queue
|
||||
//VSO: blocking push :
|
||||
iqInputQueue->push(inp);
|
||||
|
||||
DemodulatorWorkerThreadCommand command;
|
||||
//VSO: blocking push :
|
||||
workerQueue->push(command);
|
||||
|
||||
//wait blocking for termination here, it could be long with lots of modems and we MUST terminate properly,
|
||||
//else better kill the whole application...
|
||||
workerThread->isTerminated(5000);
|
||||
|
@ -313,8 +313,8 @@ void DemodulatorThread::run() {
|
||||
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator()))) {
|
||||
//non-blocking push needed for audio out
|
||||
if (!audioOutputQueue->try_push(ati)) {
|
||||
//Comment this trace, it creates to many false alarms :)
|
||||
//std::cout << "DemodulatorThread::run() cannot push ati into audioOutputQueue, is full !" << std::endl;
|
||||
|
||||
std::cout << "DemodulatorThread::run() cannot push ati into audioOutputQueue, is full !" << std::endl;
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
@ -348,10 +348,6 @@ void DemodulatorThread::run() {
|
||||
|
||||
void DemodulatorThread::terminate() {
|
||||
IOThread::terminate();
|
||||
DemodulatorThreadPostIQDataPtr inp(new DemodulatorThreadPostIQData); // push dummy to nudge queue
|
||||
|
||||
//VSO: blocking push
|
||||
iqInputQueue->push(inp);
|
||||
}
|
||||
|
||||
bool DemodulatorThread::isMuted() {
|
||||
|
@ -116,6 +116,4 @@ void DemodulatorWorkerThread::run() {
|
||||
|
||||
void DemodulatorWorkerThread::terminate() {
|
||||
IOThread::terminate();
|
||||
DemodulatorWorkerThreadCommand inp; // push dummy to nudge queue
|
||||
commandQueue->push(inp);
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ public:
|
||||
msresamp_crcf iqResampler;
|
||||
double iqResampleRatio;
|
||||
|
||||
DemodulatorThread *demodThread;
|
||||
|
||||
long long sampleRate;
|
||||
unsigned int bandwidth;
|
||||
Modem *modem;
|
||||
|
@ -235,9 +235,6 @@ void SDRPostThread::run() {
|
||||
|
||||
void SDRPostThread::terminate() {
|
||||
IOThread::terminate();
|
||||
SDRThreadIQDataPtr dummy(new SDRThreadIQData);
|
||||
//VSO: blocking push
|
||||
iqDataInQueue->push(dummy);
|
||||
}
|
||||
|
||||
void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
|
||||
|
Loading…
Reference in New Issue
Block a user