From 0724932171e1359e74e2637953f47f534f52bb0d Mon Sep 17 00:00:00 2001 From: MicheleBe Date: Thu, 3 Jan 2019 21:46:44 +0100 Subject: [PATCH 1/2] correction of std::system_error --- Chapter04/worker.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Chapter04/worker.cpp b/Chapter04/worker.cpp index e8db894..4554c9f 100644 --- a/Chapter04/worker.cpp +++ b/Chapter04/worker.cpp @@ -31,6 +31,7 @@ void Worker::getCondition(condition_variable* &cv) { // --- RUN --- // Runs the worker instance. void Worker::run() { + unique_lock ulock(mtx); while (running) { if (ready) { // Execute the request. From dbfec02eb0e6ac249ee6f933e59357f3c52837d0 Mon Sep 17 00:00:00 2001 From: MicheleBe Date: Thu, 3 Jan 2019 21:47:32 +0100 Subject: [PATCH 2/2] Correction of std::system_error --- Chapter04/worker.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chapter04/worker.h b/Chapter04/worker.h index 109ce1d..15af25f 100644 --- a/Chapter04/worker.h +++ b/Chapter04/worker.h @@ -26,13 +26,13 @@ using namespace std; class Worker { condition_variable cv; mutex mtx; - unique_lock ulock; + //unique_lock ulock; AbstractRequest* request; bool running; bool ready; public: - Worker() { running = true; ready = false; ulock = unique_lock(mtx); } + Worker() { running = true; ready = false; } void run(); void stop() { running = false; } void setRequest(AbstractRequest* request) { this->request = request; ready = true; }