httpserver: explicitly detach worker threads
When using std::thread in place of boost::thread, letting the threads destruct results in a std::terminate. According to the docs, the same thing should be be happening in later boost versions: http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.destructor I'm unsure why this hasn't blown up already, but explicitly detaching can't hurt. Zcash: cherry-picked from commit d3773ca9aeb0d2f12dc0c5a0726778050c8cb455 This fixes #2554 (zcash-cli stop during getblocktemplate long poll causes 'Assertion `!pthread_mutex_unlock(&m)' failed.')
This commit is contained in:
parent
c7f77e28f0
commit
c98b91b7c5
|
@ -447,8 +447,10 @@ bool StartHTTPServer()
|
||||||
LogPrintf("HTTP: starting %d worker threads\n", rpcThreads);
|
LogPrintf("HTTP: starting %d worker threads\n", rpcThreads);
|
||||||
threadHTTP = boost::thread(boost::bind(&ThreadHTTP, eventBase, eventHTTP));
|
threadHTTP = boost::thread(boost::bind(&ThreadHTTP, eventBase, eventHTTP));
|
||||||
|
|
||||||
for (int i = 0; i < rpcThreads; i++)
|
for (int i = 0; i < rpcThreads; i++) {
|
||||||
boost::thread(boost::bind(&HTTPWorkQueueRun, workQueue));
|
boost::thread rpc_worker(HTTPWorkQueueRun, workQueue);
|
||||||
|
rpc_worker.detach();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue