Skip to content

Commit f946654

Browse files
committed
http: Remove WaitExit from WorkQueue
This function, which waits for all threads to exit, is no longer needed now that threads are joined instead. Signed-off-by: Wladimir J. van der Laan <[email protected]>
1 parent b1c2370 commit f946654

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/httpserver.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ class WorkQueue
9999
numThreads(0)
100100
{
101101
}
102-
/** Precondition: worker threads have all stopped
103-
* (call WaitExit)
102+
/** Precondition: worker threads have all stopped (they have been joined).
104103
*/
105104
~WorkQueue()
106105
{
@@ -141,13 +140,6 @@ class WorkQueue
141140
running = false;
142141
cond.notify_all();
143142
}
144-
/** Wait for worker threads to exit */
145-
void WaitExit()
146-
{
147-
std::unique_lock<std::mutex> lock(cs);
148-
while (numThreads > 0)
149-
cond.wait(lock);
150-
}
151143
};
152144

153145
struct HTTPPathHandler
@@ -486,7 +478,6 @@ void StopHTTPServer()
486478
LogPrint(BCLog::HTTP, "Stopping HTTP server\n");
487479
if (workQueue) {
488480
LogPrint(BCLog::HTTP, "Waiting for HTTP worker threads to exit\n");
489-
workQueue->WaitExit();
490481
for (auto& thread: g_thread_http_workers) {
491482
thread.join();
492483
}

0 commit comments

Comments
 (0)