diff options
author | Mattes D <github@xoft.cz> | 2017-01-17 22:38:04 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-01-18 09:03:05 +0100 |
commit | 7cc3fb098df221f083da1d81d2327a0a5f22edf5 (patch) | |
tree | de9232cbf239800ea1e7a71cf52086509a9472ea /src/World.cpp | |
parent | Debuggers: Added a deadlock simulation command. (diff) | |
download | cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.gz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.bz2 cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.lz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.xz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.zst cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp index a9f9bfbed..d9384b8a3 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -12,6 +12,7 @@ #include "ChunkMap.h" #include "Generating/ChunkDesc.h" #include "SetChunkData.h" +#include "DeadlockDetect.h" // Serializers #include "WorldStorage/ScoreboardSerializer.h" @@ -433,8 +434,13 @@ void cWorld::InitializeSpawn(void) -void cWorld::Start(void) +void cWorld::Start(cDeadlockDetect & a_DeadlockDetect) { + // Track the CSs used by this world in the deadlock detector: + a_DeadlockDetect.TrackCriticalSection(m_CSClients, Printf("World %s clients", m_WorldName.c_str())); + a_DeadlockDetect.TrackCriticalSection(m_CSPlayers, Printf("World %s players", m_WorldName.c_str())); + a_DeadlockDetect.TrackCriticalSection(m_CSTasks, Printf("World %s tasks", m_WorldName.c_str())); + m_SpawnX = 0; m_SpawnY = cChunkDef::Height; m_SpawnZ = 0; @@ -603,6 +609,7 @@ void cWorld::Start(void) SetTimeOfDay(IniFile.GetValueSetI("General", "TimeInTicks", GetTimeOfDay())); m_ChunkMap = cpp14::make_unique<cChunkMap>(this); + m_ChunkMap->TrackInDeadlockDetect(a_DeadlockDetect, m_WorldName); // preallocate some memory for ticking blocks so we don't need to allocate that often m_BlockTickQueue.reserve(1000); @@ -953,7 +960,7 @@ void cWorld::InitialiseAndLoadMobSpawningValues(cIniFile & a_IniFile) -void cWorld::Stop(void) +void cWorld::Stop(cDeadlockDetect & a_DeadlockDetect) { // Delete the clients that have been in this world: { @@ -990,6 +997,11 @@ void cWorld::Stop(void) m_Generator.Stop(); m_ChunkSender.Stop(); m_Storage.Stop(); + + a_DeadlockDetect.UntrackCriticalSection(m_CSClients); + a_DeadlockDetect.UntrackCriticalSection(m_CSPlayers); + a_DeadlockDetect.UntrackCriticalSection(m_CSTasks); + m_ChunkMap->UntrackInDeadlockDetect(a_DeadlockDetect); } |