@ -155,7 +155,10 @@ public:
static std : : unique_ptr < CCoinsViewErrorCatcher > pcoinscatcher ;
static std : : unique_ptr < CCoinsViewErrorCatcher > pcoinscatcher ;
static std : : unique_ptr < ECCVerifyHandle > globalVerifyHandle ;
static std : : unique_ptr < ECCVerifyHandle > globalVerifyHandle ;
void Interrupt ( boost : : thread_group & threadGroup )
static boost : : thread_group threadGroup ;
static CScheduler scheduler ;
void Interrupt ( )
{
{
InterruptHTTPServer ( ) ;
InterruptHTTPServer ( ) ;
InterruptHTTPRPC ( ) ;
InterruptHTTPRPC ( ) ;
@ -164,7 +167,6 @@ void Interrupt(boost::thread_group& threadGroup)
InterruptTorControl ( ) ;
InterruptTorControl ( ) ;
if ( g_connman )
if ( g_connman )
g_connman - > Interrupt ( ) ;
g_connman - > Interrupt ( ) ;
threadGroup . interrupt_all ( ) ;
}
}
void Shutdown ( )
void Shutdown ( )
@ -199,6 +201,12 @@ void Shutdown()
g_connman . reset ( ) ;
g_connman . reset ( ) ;
StopTorControl ( ) ;
StopTorControl ( ) ;
// After everything has been shut down, but before things get flushed, stop the
// CScheduler/checkqueue threadGroup
threadGroup . interrupt_all ( ) ;
threadGroup . join_all ( ) ;
if ( fDumpMempoolLater & & gArgs . GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
if ( fDumpMempoolLater & & gArgs . GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
DumpMempool ( ) ;
DumpMempool ( ) ;
}
}
@ -705,7 +713,7 @@ bool InitSanityCheck(void)
return true ;
return true ;
}
}
bool AppInitServers ( boost : : thread_group & threadGroup )
bool AppInitServers ( )
{
{
RPCServer : : OnStarted ( & OnRPCStarted ) ;
RPCServer : : OnStarted ( & OnRPCStarted ) ;
RPCServer : : OnStopped ( & OnRPCStopped ) ;
RPCServer : : OnStopped ( & OnRPCStopped ) ;
@ -1184,7 +1192,7 @@ bool AppInitLockDataDirectory()
return true ;
return true ;
}
}
bool AppInitMain ( boost : : thread_group & threadGroup , CScheduler & scheduler )
bool AppInitMain ( )
{
{
const CChainParams & chainparams = Params ( ) ;
const CChainParams & chainparams = Params ( ) ;
// ********************************************************* Step 4a: application initialization
// ********************************************************* Step 4a: application initialization
@ -1251,7 +1259,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
if ( gArgs . GetBoolArg ( " -server " , false ) )
if ( gArgs . GetBoolArg ( " -server " , false ) )
{
{
uiInterface . InitMessage . connect ( SetRPCWarmupStatus ) ;
uiInterface . InitMessage . connect ( SetRPCWarmupStatus ) ;
if ( ! AppInitServers ( threadGroup ) )
if ( ! AppInitServers ( ) )
return InitError ( _ ( " Unable to start HTTP server. See debug log for details. " ) ) ;
return InitError ( _ ( " Unable to start HTTP server. See debug log for details. " ) ) ;
}
}