This lock is actually needed, restore it.

This commit is contained in:
vsonnier 2017-08-27 13:35:11 +02:00
parent 3c3939e0b7
commit b52c4ac8a6
2 changed files with 9 additions and 0 deletions

View File

@ -83,6 +83,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.
@ -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();

View File

@ -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;