Browse Source

Merge #5679: Get rid of DetectShutdownThread

28ee7e8 Get rid of DetectShutdownThread (Wladimir J. van der Laan)
0.13
Wladimir J. van der Laan 10 years ago
parent
commit
beff11a3a1
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 16
      src/bitcoind.cpp

16
src/bitcoind.cpp

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
static bool fDaemon;
void DetectShutdownThread(boost::thread_group* threadGroup)
void WaitForShutdown(boost::thread_group* threadGroup)
{
bool fShutdown = ShutdownRequested();
// Tell the main threads to shutdown.
@ -56,7 +56,6 @@ void DetectShutdownThread(boost::thread_group* threadGroup) @@ -56,7 +56,6 @@ void DetectShutdownThread(boost::thread_group* threadGroup)
bool AppInit(int argc, char* argv[])
{
boost::thread_group threadGroup;
boost::thread* detectShutdownThread = NULL;
bool fRet = false;
@ -144,7 +143,6 @@ bool AppInit(int argc, char* argv[]) @@ -144,7 +143,6 @@ bool AppInit(int argc, char* argv[])
#endif
SoftSetBoolArg("-server", true);
detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));
fRet = AppInit2(threadGroup);
}
catch (const std::exception& e) {
@ -155,20 +153,12 @@ bool AppInit(int argc, char* argv[]) @@ -155,20 +153,12 @@ bool AppInit(int argc, char* argv[])
if (!fRet)
{
if (detectShutdownThread)
detectShutdownThread->interrupt();
threadGroup.interrupt_all();
// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
// the startup-failure cases to make sure they don't result in a hang due to some
// thread-blocking-waiting-for-another-thread-during-startup case
}
if (detectShutdownThread)
{
detectShutdownThread->join();
delete detectShutdownThread;
detectShutdownThread = NULL;
} else {
WaitForShutdown(&threadGroup);
}
Shutdown();

Loading…
Cancel
Save