aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-01-30 12:34:11 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-01-30 13:04:30 +0100
commit3448907a68e0f719be3bf82f4d321a30975d3539 (patch)
tree9201e7e58e6104f72906bd8f10ca6bdcace8d7de /src/bitcoind.cpp
parent7936446268e2f63baa855d694df0243924b7e1a9 (diff)
parent082a61c69d7a539b5a48c4376a657f1c5aa92d81 (diff)
downloadbitcoin-3448907a68e0f719be3bf82f4d321a30975d3539.tar.xz
Merge #12266: Move scheduler/threadGroup into common-init instead of per-app
082a61c Move scheduler/threadGroup into common-init instead of per-app (Matt Corallo) Pull request description: This resolves #12229 which pointed out a shutdown deadlock due to scheduler/checkqueue having been shut down while network message processing is still running. Tree-SHA512: 0c0a76113996b164b0610d3b8c40b396f3e384d165bf098768e31fe3701b00763d0d810ef24702387e2e936fefb9fb900a6225f7417bb0175b585f365d542660
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r--src/bitcoind.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index de19787a16..d3eb60725f 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -14,7 +14,6 @@
#include <rpc/server.h>
#include <init.h>
#include <noui.h>
-#include <scheduler.h>
#include <util.h>
#include <httpserver.h>
#include <httprpc.h>
@@ -40,7 +39,7 @@
* Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code.
*/
-void WaitForShutdown(boost::thread_group* threadGroup)
+void WaitForShutdown()
{
bool fShutdown = ShutdownRequested();
// Tell the main threads to shutdown.
@@ -49,11 +48,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
MilliSleep(200);
fShutdown = ShutdownRequested();
}
- if (threadGroup)
- {
- Interrupt(*threadGroup);
- threadGroup->join_all();
- }
+ Interrupt();
}
//////////////////////////////////////////////////////////////////////////////
@@ -62,9 +57,6 @@ void WaitForShutdown(boost::thread_group* threadGroup)
//
bool AppInit(int argc, char* argv[])
{
- boost::thread_group threadGroup;
- CScheduler scheduler;
-
bool fRet = false;
//
@@ -165,7 +157,7 @@ bool AppInit(int argc, char* argv[])
// If locking the data directory failed, exit immediately
return false;
}
- fRet = AppInitMain(threadGroup, scheduler);
+ fRet = AppInitMain();
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
@@ -175,10 +167,9 @@ bool AppInit(int argc, char* argv[])
if (!fRet)
{
- Interrupt(threadGroup);
- threadGroup.join_all();
+ Interrupt();
} else {
- WaitForShutdown(&threadGroup);
+ WaitForShutdown();
}
Shutdown();