Small cleanup in Master class, thanks to 41782992@qq.com

Closes issue #2793

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-06-25 01:30:06 +02:00
parent 19f69d2bad
commit d54b534dca
2 changed files with 4 additions and 27 deletions

View File

@@ -54,11 +54,6 @@
extern int m_ServiceStatus;
#endif
/// \todo Warning disabling not useful under VC++2005. Can somebody say on which compiler it is useful?
#pragma warning(disable:4305)
volatile uint32 Master::m_masterLoopCounter = 0;
/// Handle cored's termination signals
class CoredSignalHandler : public Trinity::SignalHandler
{
@@ -91,42 +86,25 @@ public:
void SetDelayTime(uint32 t) { _delaytime = t; }
void run(void)
{
if(!_delaytime)
if (!_delaytime)
return;
sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000);
m_loops = 0;
w_loops = 0;
m_lastchange = 0;
w_lastchange = 0;
while(!World::IsStopped())
while (!World::IsStopped())
{
ACE_Based::Thread::Sleep(1000);
uint32 curtime = getMSTime();
//DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter);
// There is no Master anymore
// TODO: clear the rest of the code
// // normal work
// if(m_loops != Master::m_masterLoopCounter)
// {
// m_lastchange = curtime;
// m_loops = Master::m_masterLoopCounter;
// }
// // possible freeze
// else if(getMSTimeDiff(m_lastchange,curtime) > _delaytime)
// {
// sLog.outError("Main/Sockets Thread hangs, kicking out server!");
// *((uint32 volatile*)NULL) = 0; // bang crash
// }
// normal work
if(w_loops != World::m_worldLoopCounter)
if (w_loops != World::m_worldLoopCounter)
{
w_lastchange = curtime;
w_loops = World::m_worldLoopCounter;
}
// possible freeze
else if(getMSTimeDiff(w_lastchange,curtime) > _delaytime)
else if (getMSTimeDiff(w_lastchange,curtime) > _delaytime)
{
sLog.outError("World Thread hangs, kicking out server!");
*((uint32 volatile*)NULL) = 0; // bang crash

View File

@@ -34,7 +34,6 @@ class Master
Master();
~Master();
int Run();
static volatile uint32 m_masterLoopCounter;
private:
bool _StartDB();