From 4cd7edba47e0606158db0abd2e8486e7b9f7f830 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 7 Feb 2018 09:53:46 +0100 Subject: [PATCH] http: Remove numThreads and ThreadCounter The HTTP worker thread counter, as well as the RAII object that was used to maintain it, is unused now, so can be removed. Signed-off-by: Wladimir J. van der Laan Github-Pull: #12366 Rebased-From: 11e01515fe0fbc7823d4111ad6e016a02c485a78 Tree-SHA512: 87055c4c14986973f4c1604db264fb5a9de21bb481e9d39b201774e2d17ed92a7d1617449471c13f56e0f1f09a8aebdf1254a71d6c7b856c880a5b71e0c3ba9d --- src/httpserver.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 5000b0e24..f78ce1373 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -73,30 +73,10 @@ private: std::deque> queue; bool running; size_t maxDepth; - int numThreads; - - /** RAII object to keep track of number of running worker threads */ - class ThreadCounter - { - public: - WorkQueue &wq; - explicit ThreadCounter(WorkQueue &w): wq(w) - { - std::lock_guard lock(wq.cs); - wq.numThreads += 1; - } - ~ThreadCounter() - { - std::lock_guard lock(wq.cs); - wq.numThreads -= 1; - wq.cond.notify_all(); - } - }; public: explicit WorkQueue(size_t _maxDepth) : running(true), - maxDepth(_maxDepth), - numThreads(0) + maxDepth(_maxDepth) { } /** Precondition: worker threads have all stopped (they have been joined). @@ -118,7 +98,6 @@ public: /** Thread function */ void Run() { - ThreadCounter count(*this); while (true) { std::unique_ptr i; {