aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorCory Fields <[email protected]>2016-07-28 18:21:00 -0400
committerCory Fields <[email protected]>2016-07-28 19:07:23 -0400
commitd3773ca9aeb0d2f12dc0c5a0726778050c8cb455 (patch)
tree1e084ffa62450d8beea7d9c3aab1aa437f542483 /src/httpserver.cpp
parenthttpserver: use a future rather than relying on boost's try_join_for (diff)
downloaddiscoin-d3773ca9aeb0d2f12dc0c5a0726778050c8cb455.tar.xz
discoin-d3773ca9aeb0d2f12dc0c5a0726778050c8cb455.zip
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.
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 7150f96ed..8d0d3c158 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -451,8 +451,10 @@ bool StartHTTPServer()
threadResult = task.get_future();
threadHTTP = boost::thread(std::bind(std::move(task), eventBase, eventHTTP));
- for (int i = 0; i < rpcThreads; i++)
- boost::thread(boost::bind(&HTTPWorkQueueRun, workQueue));
+ for (int i = 0; i < rpcThreads; i++) {
+ boost::thread rpc_worker(HTTPWorkQueueRun, workQueue);
+ rpc_worker.detach();
+ }
return true;
}