@ -9,15 +9,18 @@
void DetectShutdownThread ( boost : : thread_group * threadGroup )
void DetectShutdownThread ( boost : : thread_group * threadGroup )
{
{
bool s hutdown = ShutdownRequested ( ) ;
bool fS hutdown = ShutdownRequested ( ) ;
// Tell the main threads to shutdown.
// Tell the main threads to shutdown.
while ( ! s hutdown)
while ( ! fS hutdown)
{
{
MilliSleep ( 200 ) ;
MilliSleep ( 200 ) ;
s hutdown = ShutdownRequested ( ) ;
fS hutdown = ShutdownRequested ( ) ;
}
}
if ( threadGroup )
if ( threadGroup )
{
threadGroup - > interrupt_all ( ) ;
threadGroup - > interrupt_all ( ) ;
threadGroup - > join_all ( ) ;
}
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@ -107,10 +110,16 @@ bool AppInit(int argc, char* argv[])
} catch ( . . . ) {
} catch ( . . . ) {
PrintExceptionContinue ( NULL , " AppInit() " ) ;
PrintExceptionContinue ( NULL , " AppInit() " ) ;
}
}
if ( ! fRet ) {
if ( ! fRet )
{
if ( detectShutdownThread )
if ( detectShutdownThread )
detectShutdownThread - > interrupt ( ) ;
detectShutdownThread - > interrupt ( ) ;
threadGroup . interrupt_all ( ) ;
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 )
if ( detectShutdownThread )