From 67d963a0c8ec59bd507fbb0f152547b7d792c690 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 29 Jan 2017 11:48:42 +0100 Subject: [PATCH] [IPC] Better worker cleanup --- src/Utils/IPC.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Utils/IPC.cpp b/src/Utils/IPC.cpp index 5dd7d98d..3822db53 100644 --- a/src/Utils/IPC.cpp +++ b/src/Utils/IPC.cpp @@ -14,13 +14,12 @@ namespace Utils Channel::~Channel() { - { - std::lock_guard _(this->queueMutex); - this->terminateQueue = true; - this->queueEvent.notify_all(); - } + std::unique_lock lock(this->queueMutex); + this->terminateQueue = true; + this->queueEvent.notify_all(); + lock.unlock(); - if(this->queueThread.joinable()) + if (this->queueThread.joinable()) { this->queueThread.join(); }