Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.cpp
Show First 20 Lines • Show All 460 Lines • ▼ Show 20 Lines | if (workQueue) { | ||||
for (auto &thread : g_thread_http_workers) { | for (auto &thread : g_thread_http_workers) { | ||||
thread.join(); | thread.join(); | ||||
} | } | ||||
g_thread_http_workers.clear(); | g_thread_http_workers.clear(); | ||||
delete workQueue; | delete workQueue; | ||||
} | } | ||||
if (eventBase) { | if (eventBase) { | ||||
LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n"); | LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n"); | ||||
// Exit the event loop as soon as there are no active events. | |||||
event_base_loopexit(eventBase, nullptr); | |||||
// Give event loop a few seconds to exit (to send back last RPC | // Give event loop a few seconds to exit (to send back last RPC | ||||
// responses), then break it. Before this was solved with | // responses), then break it. Before this was solved with | ||||
// event_base_loopexit, but that didn't work as expected in at least | // event_base_loopexit, but that didn't work as expected in at least | ||||
// libevent 2.0.21 and always introduced a delay. In libevent master | // libevent 2.0.21 and always introduced a delay. In libevent master | ||||
// that appears to be solved, so in the future that solution could be | // that appears to be solved, so in the future that solution could be | ||||
// used again (if desirable). | // used again (if desirable). | ||||
// (see discussion in https://github.com/bitcoin/bitcoin/pull/6990) | // (see discussion in https://github.com/bitcoin/bitcoin/pull/6990) | ||||
if (threadResult.valid() && | if (threadResult.valid() && | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |