Fix conditional wait.
Summary: It could happen that the garbage collector waits for the sleep period before exiting thread since notify_one wasn't done after mutex locking. Reviewers: mislav.bradac Reviewed By: mislav.bradac Differential Revision: https://phabricator.memgraph.io/D206
This commit is contained in:
parent
3d2b37ed35
commit
cac422f6a8
@ -27,7 +27,10 @@ class GarbageCollector : public Loggable {
|
|||||||
|
|
||||||
~GarbageCollector() {
|
~GarbageCollector() {
|
||||||
destruction_.store(true);
|
destruction_.store(true);
|
||||||
condition_variable_.notify_one();
|
{
|
||||||
|
std::unique_lock<std::mutex> lk(mutex_);
|
||||||
|
condition_variable_.notify_one();
|
||||||
|
}
|
||||||
if (run_thread_.joinable()) run_thread_.join();
|
if (run_thread_.joinable()) run_thread_.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user