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
|
#endif
|
||||||
|
|
||||||
std::cout << "Audio thread done." << std::endl;
|
|
||||||
|
|
||||||
if (threadQueueNotify != NULL) {
|
if (threadQueueNotify != NULL) {
|
||||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED);
|
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED);
|
||||||
tCmd.context = this;
|
tCmd.context = this;
|
||||||
threadQueueNotify->push(tCmd);
|
threadQueueNotify->push(tCmd);
|
||||||
}
|
}
|
||||||
|
std::cout << "Audio thread done." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread::terminate() {
|
void AudioThread::terminate() {
|
||||||
|
@ -126,12 +126,14 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
||||||
t_Audio->join();
|
t_Audio->join();
|
||||||
audioTerminated = true;
|
audioTerminated = true;
|
||||||
|
delete t_Audio;
|
||||||
break;
|
break;
|
||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pthread_join(t_Demod, NULL);
|
pthread_join(t_Demod, NULL);
|
||||||
#else
|
#else
|
||||||
t_Demod->join();
|
t_Demod->join();
|
||||||
|
delete t_Demod;
|
||||||
#endif
|
#endif
|
||||||
demodTerminated = true;
|
demodTerminated = true;
|
||||||
break;
|
break;
|
||||||
@ -140,6 +142,7 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
pthread_join(t_PreDemod, NULL);
|
pthread_join(t_PreDemod, NULL);
|
||||||
#else
|
#else
|
||||||
t_PreDemod->join();
|
t_PreDemod->join();
|
||||||
|
delete t_PreDemod;
|
||||||
#endif
|
#endif
|
||||||
preDemodTerminated = true;
|
preDemodTerminated = true;
|
||||||
break;
|
break;
|
||||||
|
@ -239,10 +239,10 @@ void DemodulatorPreThread::threadMain() {
|
|||||||
delete iqDataDel;
|
delete iqDataDel;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Demodulator preprocessor thread done." << std::endl;
|
|
||||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
||||||
tCmd.context = this;
|
tCmd.context = this;
|
||||||
threadQueueNotify->push(tCmd);
|
threadQueueNotify->push(tCmd);
|
||||||
|
std::cout << "Demodulator preprocessor thread done." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorPreThread::terminate() {
|
void DemodulatorPreThread::terminate() {
|
||||||
@ -250,4 +250,6 @@ void DemodulatorPreThread::terminate() {
|
|||||||
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
|
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
|
||||||
iqInputQueue->push(inp);
|
iqInputQueue->push(inp);
|
||||||
workerThread->terminate();
|
workerThread->terminate();
|
||||||
|
t_Worker->detach();
|
||||||
|
delete t_Worker;
|
||||||
}
|
}
|
||||||
|
@ -406,10 +406,10 @@ void DemodulatorThread::threadMain() {
|
|||||||
delete audioDataDel;
|
delete audioDataDel;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Demodulator thread done." << std::endl;
|
|
||||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
||||||
tCmd.context = this;
|
tCmd.context = this;
|
||||||
threadQueueNotify->push(tCmd);
|
threadQueueNotify->push(tCmd);
|
||||||
|
std::cout << "Demodulator thread done." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorThread::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
|
void DemodulatorThread::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
|
||||||
|
@ -31,7 +31,7 @@ void DemodulatorWorkerThread::threadMain() {
|
|||||||
done = commandQueue->empty();
|
done = commandQueue->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterChanged) {
|
if (filterChanged && !terminated) {
|
||||||
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
|
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
|
||||||
|
|
||||||
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
|
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
|
||||||
|
Loading…
Reference in New Issue
Block a user