mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Small cleanup in Master class, thanks to 41782992@qq.com
Closes issue #2793 --HG-- branch : trunk
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -34,7 +34,6 @@ class Master
|
||||
Master();
|
||||
~Master();
|
||||
int Run();
|
||||
static volatile uint32 m_masterLoopCounter;
|
||||
|
||||
private:
|
||||
bool _StartDB();
|
||||
|
||||
Reference in New Issue
Block a user