diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-11-08 17:07:40 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2018-08-03 07:11:37 -0500 |
commit | 9c4dc597ddc66acfd58a945a5ab11f833731abba (patch) | |
tree | 65dd64eda8515ccc9245a1b4bb2211d60c620c07 /src/httpserver.cpp | |
parent | 1382913e61f5db6ba849b1e261e8aefcd5a1ae68 (diff) |
Use LOCK macros for non-recursive locks
Instead of std::unique_lock.
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r-- | src/httpserver.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 9daf3d1968..ceddc7c2c5 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -69,7 +69,7 @@ class WorkQueue { private: /** Mutex protects entire object */ - std::mutex cs; + CWaitableCriticalSection cs; std::condition_variable cond; std::deque<std::unique_ptr<WorkItem>> queue; bool running; @@ -88,7 +88,7 @@ public: /** Enqueue a work item */ bool Enqueue(WorkItem* item) { - std::unique_lock<std::mutex> lock(cs); + LOCK(cs); if (queue.size() >= maxDepth) { return false; } @@ -102,7 +102,7 @@ public: while (true) { std::unique_ptr<WorkItem> i; { - std::unique_lock<std::mutex> lock(cs); + WAIT_LOCK(cs, lock); while (running && queue.empty()) cond.wait(lock); if (!running) @@ -116,7 +116,7 @@ public: /** Interrupt and exit loops */ void Interrupt() { - std::unique_lock<std::mutex> lock(cs); + LOCK(cs); running = false; cond.notify_all(); } |