diff options
author | megamage <none@none> | 2008-11-20 16:16:57 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-11-20 16:16:57 -0600 |
commit | 1e997b95cc89c615adf2acd27a5f6916b78e0ff3 (patch) | |
tree | 491c496b798daf9b20db6397ae3f0affb6fd3738 /src/trinitycore/Master.cpp | |
parent | 0b61584e1b19afb8dbef376a4e2903d8631bfc1d (diff) |
Re-commit 262 due to EOL issues. (no difference from 262)
--HG--
branch : trunk
Diffstat (limited to 'src/trinitycore/Master.cpp')
-rw-r--r-- | src/trinitycore/Master.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index 47a12484151..317a3a31a15 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -77,7 +77,7 @@ public: w_loops = 0; m_lastchange = 0; w_lastchange = 0; - while(!World::m_stopEvent) + while(!World::IsStopped()) { ZThread::Thread::sleep(1000); uint32 curtime = getMSTime(); @@ -172,13 +172,13 @@ public: // if use ra spend time waiting for io, if not use ra ,just sleep if (usera) - while (!World::m_stopEvent) + while (!World::IsStopped()) { h.Select (0, socketSelecttime); checkping (); } else - while (!World::m_stopEvent) + while (!World::IsStopped()) { ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000)); checkping (); @@ -323,7 +323,7 @@ int Master::Run() if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1) { sLog.outError ("Failed to start network"); - World::m_stopEvent = true; + World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } @@ -394,7 +394,8 @@ int Master::Run() // fixes a memory leak related to detaching threads from the module UnloadScriptingModule(); - return sWorld.GetShutdownMask() & SHUTDOWN_MASK_RESTART ? 2 : 0; + // Exit the process with specified return value + return World::GetExitCode(); } /// Initialize connection to the databases @@ -477,17 +478,18 @@ void Master::clearOnlineAccounts() } /// Handle termination signals -/** Put the World::m_stopEvent to 'true' if a termination signal is caught **/ void Master::_OnSignal(int s) { switch (s) { case SIGINT: + World::StopNow(RESTART_EXIT_CODE); + break; case SIGTERM: #ifdef _WIN32 case SIGBREAK: #endif - World::m_stopEvent = true; + World::StopNow(SHUTDOWN_EXIT_CODE); break; } |