Skip to content

Commit 11e0151

Browse files
committed
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 <[email protected]>
1 parent f946654 commit 11e0151

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

src/httpserver.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,10 @@ class WorkQueue
7373
std::deque<std::unique_ptr<WorkItem>> queue;
7474
bool running;
7575
size_t maxDepth;
76-
int numThreads;
77-
78-
/** RAII object to keep track of number of running worker threads */
79-
class ThreadCounter
80-
{
81-
public:
82-
WorkQueue &wq;
83-
explicit ThreadCounter(WorkQueue &w): wq(w)
84-
{
85-
std::lock_guard<std::mutex> lock(wq.cs);
86-
wq.numThreads += 1;
87-
}
88-
~ThreadCounter()
89-
{
90-
std::lock_guard<std::mutex> lock(wq.cs);
91-
wq.numThreads -= 1;
92-
wq.cond.notify_all();
93-
}
94-
};
9576

9677
public:
9778
explicit WorkQueue(size_t _maxDepth) : running(true),
98-
maxDepth(_maxDepth),
99-
numThreads(0)
79+
maxDepth(_maxDepth)
10080
{
10181
}
10282
/** Precondition: worker threads have all stopped (they have been joined).
@@ -118,7 +98,6 @@ class WorkQueue
11898
/** Thread function */
11999
void Run()
120100
{
121-
ThreadCounter count(*this);
122101
while (true) {
123102
std::unique_ptr<WorkItem> i;
124103
{

0 commit comments

Comments
 (0)