mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 13:48:38 -05:00
Fix demodulator termination / thread lock
This commit is contained in:
parent
e7b22bd186
commit
2b6da304ef
@ -421,13 +421,12 @@ void AudioThread::threadMain() {
|
||||
}
|
||||
#endif
|
||||
|
||||
std::cout << "Audio thread done." << std::endl;
|
||||
|
||||
if (threadQueueNotify != NULL) {
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED);
|
||||
tCmd.context = this;
|
||||
threadQueueNotify->push(tCmd);
|
||||
}
|
||||
std::cout << "Audio thread done." << std::endl;
|
||||
}
|
||||
|
||||
void AudioThread::terminate() {
|
||||
|
@ -126,12 +126,14 @@ bool DemodulatorInstance::isTerminated() {
|
||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
||||
t_Audio->join();
|
||||
audioTerminated = true;
|
||||
delete t_Audio;
|
||||
break;
|
||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
||||
#ifdef __APPLE__
|
||||
pthread_join(t_Demod, NULL);
|
||||
#else
|
||||
t_Demod->join();
|
||||
delete t_Demod;
|
||||
#endif
|
||||
demodTerminated = true;
|
||||
break;
|
||||
@ -140,6 +142,7 @@ bool DemodulatorInstance::isTerminated() {
|
||||
pthread_join(t_PreDemod, NULL);
|
||||
#else
|
||||
t_PreDemod->join();
|
||||
delete t_PreDemod;
|
||||
#endif
|
||||
preDemodTerminated = true;
|
||||
break;
|
||||
|
@ -239,10 +239,10 @@ void DemodulatorPreThread::threadMain() {
|
||||
delete iqDataDel;
|
||||
}
|
||||
|
||||
std::cout << "Demodulator preprocessor thread done." << std::endl;
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
||||
tCmd.context = this;
|
||||
threadQueueNotify->push(tCmd);
|
||||
std::cout << "Demodulator preprocessor thread done." << std::endl;
|
||||
}
|
||||
|
||||
void DemodulatorPreThread::terminate() {
|
||||
@ -250,4 +250,6 @@ void DemodulatorPreThread::terminate() {
|
||||
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
|
||||
iqInputQueue->push(inp);
|
||||
workerThread->terminate();
|
||||
t_Worker->detach();
|
||||
delete t_Worker;
|
||||
}
|
||||
|
@ -406,10 +406,10 @@ void DemodulatorThread::threadMain() {
|
||||
delete audioDataDel;
|
||||
}
|
||||
|
||||
std::cout << "Demodulator thread done." << std::endl;
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
||||
tCmd.context = this;
|
||||
threadQueueNotify->push(tCmd);
|
||||
std::cout << "Demodulator thread done." << std::endl;
|
||||
}
|
||||
|
||||
void DemodulatorThread::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
|
||||
|
@ -31,7 +31,7 @@ void DemodulatorWorkerThread::threadMain() {
|
||||
done = commandQueue->empty();
|
||||
}
|
||||
|
||||
if (filterChanged) {
|
||||
if (filterChanged && !terminated) {
|
||||
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
|
||||
|
||||
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
|
||||
|
Loading…
Reference in New Issue
Block a user