Merge pull request #3441 from peat-psuwit/for-upstream/dbqueue-stop-mutex

db: fix dead lock in zmDbQueue::stop()
This commit is contained in:
Isaac Connor 2022-02-20 10:32:19 -05:00 committed by GitHub
commit f4412c81d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -238,8 +238,13 @@ zmDbQueue::~zmDbQueue() {
} }
void zmDbQueue::stop() { void zmDbQueue::stop() {
mTerminate = true; {
mCondition.notify_all(); std::unique_lock<std::mutex> lock(mMutex);
mTerminate = true;
mCondition.notify_all();
}
if (mThread.joinable()) mThread.join(); if (mThread.joinable()) mThread.join();
} }