Skip to content

Commit d3773ca

Browse files
committed
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.
1 parent 755aa05 commit d3773ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/httpserver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,10 @@ bool StartHTTPServer()
451451
threadResult = task.get_future();
452452
threadHTTP = boost::thread(std::bind(std::move(task), eventBase, eventHTTP));
453453

454-
for (int i = 0; i < rpcThreads; i++)
455-
boost::thread(boost::bind(&HTTPWorkQueueRun, workQueue));
454+
for (int i = 0; i < rpcThreads; i++) {
455+
boost::thread rpc_worker(HTTPWorkQueueRun, workQueue);
456+
rpc_worker.detach();
457+
}
456458
return true;
457459
}
458460

0 commit comments

Comments
 (0)