1
0

Added network termination called at app exit.

This fixes a crash in MSVC runtime caused by joining a thread in a global var's destructor.
This commit is contained in:
Mattes D
2015-01-26 14:46:20 +01:00
parent 9a2200f8bb
commit 053362e604
6 changed files with 91 additions and 18 deletions

View File

@@ -11,14 +11,18 @@
#include <dbghelp.h>
#endif // _MSC_VER
bool cRoot::m_TerminateEventRaised = false; // If something has told the server to stop; checked periodically in cRoot
static bool g_ServerTerminated = false; // Set to true when the server terminates, so our CTRL handler can then tell the OS to close the console
#include "OSSupport/NetworkSingleton.h"
/** If something has told the server to stop; checked periodically in cRoot */
bool cRoot::m_TerminateEventRaised = false;
/** Set to true when the server terminates, so our CTRL handler can then tell the OS to close the console. */
static bool g_ServerTerminated = false;
/** If set to true, the protocols will log each player's incoming (C->S) communication to a per-connection logfile */
bool g_ShouldLogCommIn;
@@ -305,6 +309,9 @@ int main( int argc, char **argv)
g_ServerTerminated = true;
// Shutdown all of LibEvent:
cNetworkSingleton::Get().Terminate();
return EXIT_SUCCESS;
}