mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 04:08:36 -05:00
This lock is actually needed, restore it.
This commit is contained in:
parent
3c3939e0b7
commit
b52c4ac8a6
@ -84,6 +84,8 @@ DemodulatorInstance::DemodulatorInstance() {
|
||||
|
||||
DemodulatorInstance::~DemodulatorInstance() {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lockData(m_thread_control_mutex);
|
||||
|
||||
//now that DemodulatorInstance are managed through shared_ptr, we
|
||||
//should enter here ONLY when it is no longer used by any piece of code, anywhere.
|
||||
//so active wait on IsTerminated(), then die.
|
||||
@ -120,6 +122,8 @@ void DemodulatorInstance::setVisualOutputQueue(DemodulatorThreadOutputQueuePtr t
|
||||
|
||||
void DemodulatorInstance::run() {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lockData(m_thread_control_mutex);
|
||||
|
||||
if (active) {
|
||||
return;
|
||||
}
|
||||
@ -187,6 +191,8 @@ void DemodulatorInstance::setLabel(std::string labelStr) {
|
||||
|
||||
bool DemodulatorInstance::isTerminated() {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lockData(m_thread_control_mutex);
|
||||
|
||||
bool audioTerminated = audioThread->isTerminated();
|
||||
bool demodTerminated = demodulatorThread->isTerminated();
|
||||
bool preDemodTerminated = demodulatorPreThread->isTerminated();
|
||||
|
@ -139,6 +139,9 @@ private:
|
||||
DemodulatorThread *demodulatorThread;
|
||||
DemodulatorThreadControlCommandQueuePtr threadQueueControl;
|
||||
|
||||
//protects child thread creation and termination
|
||||
std::recursive_mutex m_thread_control_mutex;
|
||||
|
||||
std::atomic<std::string *> label; //
|
||||
// User editable buffer, 16 bit string.
|
||||
std::atomic<std::wstring *> user_label;
|
||||
|
Loading…
Reference in New Issue
Block a user