Browse Source

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 <laanwj@gmail.com>
Github-Pull: #12366
Rebased-From: f94665466ed50e868c98b1a1c708ad5767727bb6
Tree-SHA512: 5cda90b4c081424d637031c0bbf168f177667733ff20b6f77eac84e503f7fad6fab3eb897f191edd819f18b270e3ecea78974978abd102d323f42d9d06216e53
0.16
Wladimir J. van der Laan 7 years ago
parent
commit
93de37a12b
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 11
      src/httpserver.cpp

11
src/httpserver.cpp

@ -99,8 +99,7 @@ public: @@ -99,8 +99,7 @@ public:
numThreads(0)
{
}
/** Precondition: worker threads have all stopped
* (call WaitExit)
/** Precondition: worker threads have all stopped (they have been joined).
*/
~WorkQueue()
{
@ -141,13 +140,6 @@ public: @@ -141,13 +140,6 @@ public:
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);
}
};
struct HTTPPathHandler
@ -486,7 +478,6 @@ void StopHTTPServer() @@ -486,7 +478,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();
}

Loading…
Cancel
Save