From b834841aa1fc33db987e9d0b95e1678974064d04 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 30 Jan 2012 21:54:40 +0000 Subject: Fixed a problem in cCSLock (sorry); reverted cChunk git-svn-id: http://mc-server.googlecode.com/svn/trunk@195 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 6 +++--- source/cCriticalSection.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 5e9c44a18..abe1d0443 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -249,7 +249,7 @@ void cChunk::Tick(float a_Dt) } m_pState->PendingSendBlocks.clear(); } - cCSUnlock Unlock( Lock ); + Lock.Unlock(); while( !m_pState->UnloadQuery.empty() ) { @@ -261,10 +261,10 @@ void cChunk::Tick(float a_Dt) m_pState->UnloadQuery.remove( *m_pState->UnloadQuery.begin() ); } - m_pState->BlockListCriticalSection.Lock(); + cCSLock Lock2(m_pState->BlockListCriticalSection); std::map< unsigned int, int > ToTickBlocks = m_pState->ToTickBlocks; m_pState->ToTickBlocks.clear(); - m_pState->BlockListCriticalSection.Unlock(); + Lock2.Unlock(); bool isRedstone = false; for( std::map< unsigned int, int>::iterator itr = ToTickBlocks.begin(); itr != ToTickBlocks.end(); ++itr ) diff --git a/source/cCriticalSection.cpp b/source/cCriticalSection.cpp index 95ee77c3d..d7498aa5f 100644 --- a/source/cCriticalSection.cpp +++ b/source/cCriticalSection.cpp @@ -107,6 +107,12 @@ cCSLock::cCSLock(cCriticalSection & a_CS) cCSLock::~cCSLock() { + #ifdef _DEBUG + if (!m_IsLocked) + { + return; + } + #endif // _DEBUG Unlock(); } -- cgit v1.2.3