summaryrefslogtreecommitdiffstats
path: root/src/DeadlockDetect.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-04-05 02:38:43 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2021-04-12 23:35:07 +0200
commit4cd49d7eca5f8fd53eb98577a1f218a5086704bb (patch)
tree09bf29a1d30a37445796ed70867f934435c4261f /src/DeadlockDetect.cpp
parentFixed generator for the Mega Taiga biome (#5129) (diff)
downloadcuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.gz
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.bz2
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.lz
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.xz
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.zst
cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.zip
Diffstat (limited to 'src/DeadlockDetect.cpp')
-rw-r--r--src/DeadlockDetect.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/DeadlockDetect.cpp b/src/DeadlockDetect.cpp
index 3f47589d8..fc426d529 100644
--- a/src/DeadlockDetect.cpp
+++ b/src/DeadlockDetect.cpp
@@ -103,11 +103,10 @@ void cDeadlockDetect::Execute(void)
{
// Check the world ages:
cRoot::Get()->ForEachWorld([=](cWorld & a_World)
- {
- CheckWorldAge(a_World.GetName(), a_World.GetWorldAge());
- return false;
- }
- );
+ {
+ CheckWorldAge(a_World.GetName(), a_World.GetWorldAge());
+ return false;
+ });
std::this_thread::sleep_for(std::chrono::milliseconds(CYCLE_MILLISECONDS));
} // while (should run)
@@ -117,7 +116,7 @@ void cDeadlockDetect::Execute(void)
-void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, Int64 a_Age)
+void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, const cTickTimeLong a_Age)
{
m_WorldAges[a_WorldName].m_Age = a_Age;
m_WorldAges[a_WorldName].m_NumCyclesSame = 0;
@@ -127,7 +126,7 @@ void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, Int64 a_Age)
-void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age)
+void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, const cTickTimeLong a_Age)
{
WorldAges::iterator itr = m_WorldAges.find(a_WorldName);
if (itr == m_WorldAges.end())
@@ -157,14 +156,14 @@ void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age)
-void cDeadlockDetect::DeadlockDetected(const AString & a_WorldName, Int64 a_WorldAge)
+void cDeadlockDetect::DeadlockDetected(const AString & a_WorldName, const cTickTimeLong a_WorldAge)
{
LOGERROR("Deadlock detected: world %s has been stuck at age %lld. Aborting the server.",
- a_WorldName.c_str(), static_cast<long long>(a_WorldAge)
+ a_WorldName.c_str(), static_cast<long long>(a_WorldAge.count())
);
ListTrackedCSs();
ASSERT(!"Deadlock detected");
- abort();
+ std::abort();
}
@@ -182,7 +181,3 @@ void cDeadlockDetect::ListTrackedCSs(void)
);
}
}
-
-
-
-