Re-commit 262 due to EOL issues. (no difference from 262)

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-20 16:16:57 -06:00
parent 0b61584e1b
commit 1e997b95cc
359 changed files with 2730 additions and 2144 deletions

View File

@@ -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;
}