Skip to content

Commit

Permalink
http: Remove WaitExit from WorkQueue
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
laanwj authored and furszy committed Feb 18, 2021
1 parent b8f7364 commit e24c710
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ class WorkQueue
numThreads(0)
{
}
/*( Precondition: worker threads have all stopped
* (call WaitExit)
/** Precondition: worker threads have all stopped (they have been joined).
*/
~WorkQueue()
{
Expand Down Expand Up @@ -147,13 +146,6 @@ class WorkQueue
running = false;
cond.notify_all();
}
/** Wait for worker threads to exit */
void WaitExit()
{
std::unique_lock<std::mutex> lock(cs);
while (numThreads > 0)
cond.wait(lock);
}

/** Return current depth of queue */
size_t Depth()
Expand Down Expand Up @@ -501,7 +493,6 @@ void StopHTTPServer()
LogPrint(BCLog::HTTP, "Stopping HTTP server\n");
if (workQueue) {
LogPrint(BCLog::HTTP, "Waiting for HTTP worker threads to exit\n");
workQueue->WaitExit();
for (auto& thread: g_thread_http_workers) {
thread.join();
}
Expand Down

0 comments on commit e24c710

Please sign in to comment.