本文整理汇总了C++中FreezeDetectorRunnable::SetDelayTime方法的典型用法代码示例。如果您正苦于以下问题:C++ FreezeDetectorRunnable::SetDelayTime方法的具体用法?C++ FreezeDetectorRunnable::SetDelayTime怎么用?C++ FreezeDetectorRunnable::SetDelayTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreezeDetectorRunnable
的用法示例。
在下文中一共展示了FreezeDetectorRunnable::SetDelayTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
//.........这里部分代码省略.........
sLog.outString();
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("mangosd process priority class set to HIGH");
else
sLog.outError("Can't set mangosd process priority class.");
sLog.outString();
}
}
#endif
///- Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if(sConfig.GetBoolDefault("SOAP.Enabled", false))
{
MaNGOSsoapRunnable *runnable = new MaNGOSsoapRunnable();
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable);
}
///- Start up freeze catcher thread
ACE_Based::Thread* freeze_thread = NULL;
if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
freeze_thread = new ACE_Based::Thread(fdr);
freeze_thread->setPriority(ACE_Based::Highest);
}
///- Launch the world listener socket
uint16 wsport = sWorld.getConfig (CONFIG_UINT32_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1)
{
sLog.outError ("Failed to start network");
Log::WaitBeforeContinueIfNeed();
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
///- Stop freeze protection before shutdown tasks
if (freeze_thread)
{
freeze_thread->destroy();
delete freeze_thread;
}
///- Stop soap thread
if(soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
示例2: Run
//.........这里部分代码省略.........
if (Prio)
{
if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("ShadowCore process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set ShadowCore process priority class.");
sLog.outString();
}
}
#endif
// Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if (sConfig.GetBoolDefault("SOAP.Enabled", false))
{
OCSoapRunnable *runnable = new OCSoapRunnable();
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable);
}
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// Start up freeze catcher thread
ACE_Based::Thread* freeze_thread = NULL;
if (uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
freeze_thread = new ACE_Based::Thread(fdr);
freeze_thread->setPriority(ACE_Based::Highest);
}
// Launch the world listener socket
port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait();
// Stop freeze protection before shutdown tasks
if (freeze_thread)
{
freeze_thread->destroy();
delete freeze_thread;
}
// Stop soap thread
if (soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
示例3: Run
//.........这里部分代码省略.........
sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff);
else
sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff);
}
}
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
//if (Prio && (m_ServiceStatus == -1) /* need set to default process priority class in service mode*/)
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
sLog->outInfo(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH");
else
sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class.");
}
}
#endif
//Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if (ConfigMgr::GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable* runnable = new TCSoapRunnable();
runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(ConfigMgr::GetIntDefault("SOAP.Port", 7878)));
soap_thread = new ACE_Based::Thread(runnable);
}
///- Start up freeze catcher thread
if (uint32 freeze_delay = ConfigMgr::GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay * 1000);
ACE_Based::Thread freeze_thread(fdr);
freeze_thread.setPriority(ACE_Based::Highest);
}
///- Launch the world listener socket
uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD);
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1)
{
sLog->outError(LOG_FILTER_WORLDSERVER, "Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
// set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
world_thread.wait();
rar_thread.wait();
if (soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
示例4: Run
int Master::Run()
{
sLog.outString(" ___ _ _ ___ ");
sLog.outString(" / _ \\ | |_ ___ _ __ (_) __ / __| ___ _ _ ___ ");
sLog.outString(" / /_\\ \\ | _| / _ \\ | ' \\ | | / _| | (__ / _ \\ | '_| / -_)");
sLog.outString("/_/ \\_\\ \\__| \\___/ |_|_|_| |_| \\__| \\___| \\___/ |_| \\___|");
sLog.outString("");
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
if (!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
sLog.outError("Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
sLog.outString("Daemon PID: %u\n", pid);
}
if (!_StartDB())
return 1;
sWorld.SetInitialWorldSettings();
_HookSignals();
ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest);
std::string builds = AcceptableClientBuildsListStr();
LoginDatabase.escape_string(builds);
LoginDatabase.PExecute("UPDATE realmlist SET flag = flag & ~(%u), population = 0, gamebuild = '%s' WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
ACE_Based::Thread* cliThread = NULL;
#ifdef _WIN32
if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1))
#else
if (sConfig.GetBoolDefault("Console.Enable", true))
#endif
{
cliThread = new ACE_Based::Thread(new CliRunnable);
}
ACE_Based::Thread rar_thread(new RARunnable);
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess,&appAff,&sysAff))
{
ULONG_PTR curAff = Aff & appAff;
if (!curAff)
{
sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for OregonCore. Accessible processors bitmask (hex): %x",Aff,appAff);
}
else
{
if (SetProcessAffinityMask(hProcess,curAff))
sLog.outString("Using processors (bitmask, hex): %x", curAff);
else
sLog.outError("Can't set used processors (hex): %x",curAff);
}
}
sLog.outString();
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
if (Prio)
{
if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("OregonCore process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set OregonCore process priority class.");
sLog.outString();
}
}
#endif
ACE_Based::Thread* soap_thread = NULL;
if (sConfig.GetBoolDefault("SOAP.Enabled", false))
{
OCSoapRunnable* soapconnectector = new OCSoapRunnable();
soapconnectector->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfig.GetIntDefault("SOAP.Port", 7878)));
soap_thread = new ACE_Based::Thread(soapconnectector);
}
ACE_Based::Thread* freeze_thread = NULL;
if (uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
//.........这里部分代码省略.........
示例5: Run
//.........这里部分代码省略.........
}
}
sLog.outString();
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("mangosd process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set mangosd process priority class.");
sLog.outString();
}
}
#endif
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// maximum counter for next ping
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime));
uint32 loopCounter = 0;
///- Start up freeze catcher thread
ACE_Based::Thread* freeze_thread = NULL;
if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
freeze_thread = new ACE_Based::Thread(fdr);
freeze_thread->setPriority(ACE_Based::Highest);
}
///- Launch the world listener socket
port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
///- Stop freeze protection before shutdown tasks
if (freeze_thread)
{
freeze_thread->destroy();
delete freeze_thread;
}
///- Set server offline in realmlist
loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
///- Remove signal handling before leaving
_UnhookSignals();
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
示例6: Run
//.........这里部分代码省略.........
sLog.outString("");
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("TrinityCore process priority class set to HIGH");
else
sLog.outError("Can't set Trinityd process priority class.");
sLog.outString("");
}
}
#endif
//Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if(sConfig.GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable *runnable = new TCSoapRunnable();
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable);
}
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
///- Start up freeze catcher thread
if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
ACE_Based::Thread freeze_thread(fdr);
freeze_thread.setPriority(ACE_Based::Highest);
}
///- Launch the world listener socket
port_t wsport = sWorld.getIntConfig(CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
if(soap_thread)
{
soap_thread->wait();
soap_thread->destroy();
delete soap_thread;
}
// set server offline
LoginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
world_thread.wait();
rar_thread.wait ();
示例7: Run
//.........这里部分代码省略.........
}
}
sLog.outString();
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("mangosd process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set mangosd process priority class.");
sLog.outString();
}
}
#endif
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// maximum counter for next ping
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime));
uint32 loopCounter = 0;
///- Start up freeze catcher thread
uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0);
if(freeze_delay)
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
ZThread::Thread t(fdr);
t.setPriority(ZThread::High);
}
///- Launch the world listener socket
port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError ("Failed to start network");
World::m_stopEvent = true;
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
// set server offline
loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
///- Remove signal handling before leaving
_UnhookSignals();
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
t.wait();
td2.wait ();
///- Clean database before leaving
clearOnlineAccounts();
///- Wait for delay threads to end
示例8: Run
//.........这里部分代码省略.........
if (!curAff)
{
sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
}
else
{
if (SetProcessAffinityMask(hProcess, curAff))
sLog->outString("Using processors (bitmask, hex): %x", curAff);
else
sLog->outError("Can't set used processors (hex): %x", curAff);
}
}
sLog->outString("");
}
bool Prio = sConfig->GetBoolDefault("ProcessPriority", false);
//if (Prio && (m_ServiceStatus == -1) /* need set to default process priority class in service mode*/)
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
sLog->outString("Myth Core process priority class set to HIGH");
else
sLog->outError("Can't set worldserver process priority class.");
sLog->outString("");
}
}
#endif
///- Start up freeze catcher thread
if (uint32 freeze_delay = sConfig->GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
ACE_Based::Thread freeze_thread(fdr);
freeze_thread.setPriority(ACE_Based::Highest);
}
///- Launch the world listener socket
uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD);
std::string bind_ip = sConfig->GetStringDefault("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str ()) == -1)
{
sLog->outError("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
// set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sWorldSocketMgr->Wait();
// set server offline
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
world_thread.wait();
rar_thread.wait();
///- Clean database before leaving
clearOnlineAccounts();
_StopDB();
示例9: Run
//.........这里部分代码省略.........
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
sLog.outString("OregonCore process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set OregonCore process priority class.");
sLog.outString();
}
}
#endif
// Start soap serving thread
ACE_Based::Thread* soap_thread = NULL;
if (sConfig.GetBoolDefault("SOAP.Enabled", false))
{
OCSoapRunnable* runnable = new OCSoapRunnable();
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
soap_thread = new ACE_Based::Thread(runnable);
}
//uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// Start up freeze catcher thread
ACE_Based::Thread* freeze_thread = NULL;
if (uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay * 1000);
freeze_thread = new ACE_Based::Thread(fdr);
freeze_thread->setPriority(ACE_Based::Highest);
}
// Launch the world listener socket
uint16 wsport = sWorld.getConfig(CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
// give other threads a chance to start-up so we can shutdown them safely
ACE_Based::Thread::Sleep(1500);
}
/* Run our World, we use main thread for this,
because it we need the highest priority possible */
WorldRunnable().run();
// Stop freeze protection before shutdown tasks
if (freeze_thread)
{
freeze_thread->kill(-1); // destroy
freeze_thread->wait();
delete freeze_thread;
}
sWorldSocketMgr->Wait();
// Stop soap thread