DeadlockDetect now uses sleep instead of timed-wait semaphores.
The semaphores' timed-wait still has issues on Linux, it's just easier to use cSleep instead.
This commit is contained in:
parent
fdbe835131
commit
2d7c72f1b7
@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
|
|
||||||
/// Number of milliseconds per cycle
|
/// Number of milliseconds per cycle
|
||||||
const int CYCLE_MILLISECONDS = 500;
|
const int CYCLE_MILLISECONDS = 100;
|
||||||
|
|
||||||
/// When the number of cycles for the same world age hits this value, it is considered a deadlock
|
/// When the number of cycles for the same world age hits this value, it is considered a deadlock
|
||||||
const int NUM_CYCLES_LIMIT = 40; // 40 = twenty seconds
|
const int NUM_CYCLES_LIMIT = 200; // 200 = twenty seconds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -60,20 +60,10 @@ bool cDeadlockDetect::Start(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cDeadlockDetect::Stop(void)
|
|
||||||
{
|
|
||||||
m_EvtTerminate.Set();
|
|
||||||
super::Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cDeadlockDetect::Execute(void)
|
void cDeadlockDetect::Execute(void)
|
||||||
{
|
{
|
||||||
// Loop until the event is signalled
|
// Loop until the event is signalled
|
||||||
while (m_EvtTerminate.Wait(CYCLE_MILLISECONDS) == cEvent::wrTimeout)
|
while (!m_ShouldTerminate)
|
||||||
{
|
{
|
||||||
// Check the world ages:
|
// Check the world ages:
|
||||||
class cChecker :
|
class cChecker :
|
||||||
@ -95,6 +85,8 @@ void cDeadlockDetect::Execute(void)
|
|||||||
}
|
}
|
||||||
} Checker(this);
|
} Checker(this);
|
||||||
cRoot::Get()->ForEachWorld(Checker);
|
cRoot::Get()->ForEachWorld(Checker);
|
||||||
|
|
||||||
|
cSleep::MilliSleep(CYCLE_MILLISECONDS);
|
||||||
} // while (should run)
|
} // while (should run)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@ public:
|
|||||||
/// Starts the detection. Hides cIsThread's Start, because we need some initialization
|
/// Starts the detection. Hides cIsThread's Start, because we need some initialization
|
||||||
bool Start(void);
|
bool Start(void);
|
||||||
|
|
||||||
/// Stops the detection. Hides cIsThread's Stop, because we need to signal m_EvtTerminate
|
|
||||||
void Stop(void);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct sWorldAge
|
struct sWorldAge
|
||||||
{
|
{
|
||||||
@ -49,8 +46,6 @@ protected:
|
|||||||
|
|
||||||
WorldAges m_WorldAges;
|
WorldAges m_WorldAges;
|
||||||
|
|
||||||
cEvent m_EvtTerminate;
|
|
||||||
|
|
||||||
|
|
||||||
// cIsThread overrides:
|
// cIsThread overrides:
|
||||||
virtual void Execute(void) override;
|
virtual void Execute(void) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user