DeadlockDetect is configurable now.
This is needed when debugging Lua plugins.
This commit is contained in:
parent
9a36564ce9
commit
bf30528ec4
@ -31,8 +31,10 @@ cDeadlockDetect::cDeadlockDetect(void) :
|
||||
|
||||
|
||||
|
||||
bool cDeadlockDetect::Start(void)
|
||||
bool cDeadlockDetect::Start(int a_IntervalSec)
|
||||
{
|
||||
m_IntervalSec = a_IntervalSec;
|
||||
|
||||
// Read the initial world data:
|
||||
class cFillIn :
|
||||
public cWorldListCallback
|
||||
@ -115,7 +117,7 @@ void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age)
|
||||
if (itr->second.m_Age == a_Age)
|
||||
{
|
||||
itr->second.m_NumCyclesSame += 1;
|
||||
if (itr->second.m_NumCyclesSame > NUM_CYCLES_LIMIT)
|
||||
if (itr->second.m_NumCyclesSame > (1000 * m_IntervalSec) / CYCLE_MILLISECONDS)
|
||||
{
|
||||
DeadlockDetected();
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
cDeadlockDetect(void);
|
||||
|
||||
/// Starts the detection. Hides cIsThread's Start, because we need some initialization
|
||||
bool Start(void);
|
||||
bool Start(int a_IntervalSec);
|
||||
|
||||
protected:
|
||||
struct sWorldAge
|
||||
@ -46,6 +46,9 @@ protected:
|
||||
|
||||
WorldAges m_WorldAges;
|
||||
|
||||
/// Number of secods for which the ages must be the same for the detection to trigger
|
||||
int m_IntervalSec;
|
||||
|
||||
|
||||
// cIsThread overrides:
|
||||
virtual void Execute(void) override;
|
||||
|
@ -165,13 +165,16 @@ void cRoot::Start(void)
|
||||
LOGD("Starting Authenticator...");
|
||||
m_Authenticator.Start(IniFile);
|
||||
|
||||
IniFile.WriteFile("settings.ini");
|
||||
|
||||
LOGD("Starting worlds...");
|
||||
StartWorlds();
|
||||
|
||||
if (IniFile.GetValueSetB("DeadlockDetect", "Enabled", true))
|
||||
{
|
||||
LOGD("Starting deadlock detector...");
|
||||
dd.Start();
|
||||
dd.Start(IniFile.GetValueSetI("DeadlockDetect", "IntervalSec", 20));
|
||||
}
|
||||
|
||||
IniFile.WriteFile("settings.ini");
|
||||
|
||||
LOGD("Finalising startup...");
|
||||
m_Server->Start();
|
||||
|
Loading…
Reference in New Issue
Block a user