diff --git a/src/zm_db.cpp b/src/zm_db.cpp index cc0797c12..76bd04e27 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -238,8 +238,13 @@ zmDbQueue::~zmDbQueue() { } void zmDbQueue::stop() { - mTerminate = true; - mCondition.notify_all(); + { + std::unique_lock lock(mMutex); + + mTerminate = true; + mCondition.notify_all(); + } + if (mThread.joinable()) mThread.join(); }