Merge pull request #3059 from Diapolo/Shutdown
add missing Boost Thread join_all() call during shutdown
This commit is contained in:
commit
aa56d317a5
1 changed files with 13 additions and 4 deletions
|
@ -9,15 +9,18 @@
|
|||
|
||||
void DetectShutdownThread(boost::thread_group* threadGroup)
|
||||
{
|
||||
bool shutdown = ShutdownRequested();
|
||||
bool fShutdown = ShutdownRequested();
|
||||
// Tell the main threads to shutdown.
|
||||
while (!shutdown)
|
||||
while (!fShutdown)
|
||||
{
|
||||
MilliSleep(200);
|
||||
shutdown = ShutdownRequested();
|
||||
fShutdown = ShutdownRequested();
|
||||
}
|
||||
if (threadGroup)
|
||||
{
|
||||
threadGroup->interrupt_all();
|
||||
threadGroup->join_all();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -107,10 +110,16 @@ bool AppInit(int argc, char* argv[])
|
|||
} catch (...) {
|
||||
PrintExceptionContinue(NULL, "AppInit()");
|
||||
}
|
||||
if (!fRet) {
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue