diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-09-11 23:20:49 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-09-11 23:20:49 +0200 |
commit | e225b7f8262df48ad4d7094bc295add3007b0649 (patch) | |
tree | a42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/DeadlockDetect.cpp | |
parent | cBlockArea: change MakeIndex to return size_t (diff) | |
download | cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2 cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip |
Diffstat (limited to 'src/DeadlockDetect.cpp')
-rw-r--r-- | src/DeadlockDetect.cpp | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/src/DeadlockDetect.cpp b/src/DeadlockDetect.cpp index df14e610b..411d452f6 100644 --- a/src/DeadlockDetect.cpp +++ b/src/DeadlockDetect.cpp @@ -56,25 +56,12 @@ bool cDeadlockDetect::Start(int a_IntervalSec) m_IntervalSec = a_IntervalSec; // Read the initial world data: - class cFillIn : - public cWorldListCallback - { - public: - cFillIn(cDeadlockDetect * a_Detect) : - m_Detect(a_Detect) - { - } - - virtual bool Item(cWorld * a_World) override + cRoot::Get()->ForEachWorld([=](cWorld & a_World) { - m_Detect->SetWorldAge(a_World->GetName(), a_World->GetWorldAge()); + SetWorldAge(a_World.GetName(), a_World.GetWorldAge()); return false; } - - protected: - cDeadlockDetect * m_Detect; - } FillIn(this); - cRoot::Get()->ForEachWorld(FillIn); + ); return super::Start(); } @@ -115,25 +102,12 @@ void cDeadlockDetect::Execute(void) while (!m_ShouldTerminate) { // Check the world ages: - class cChecker : - public cWorldListCallback - { - public: - cChecker(cDeadlockDetect * a_Detect) : - m_Detect(a_Detect) - { - } - - protected: - cDeadlockDetect * m_Detect; - - virtual bool Item(cWorld * a_World) override + cRoot::Get()->ForEachWorld([=](cWorld & a_World) { - m_Detect->CheckWorldAge(a_World->GetName(), a_World->GetWorldAge()); + CheckWorldAge(a_World.GetName(), a_World.GetWorldAge()); return false; } - } Checker(this); - cRoot::Get()->ForEachWorld(Checker); + ); std::this_thread::sleep_for(std::chrono::milliseconds(CYCLE_MILLISECONDS)); } // while (should run) |