From 81b896f459b57192c070fde959c8537e4c933e21 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Sat, 26 Sep 2009 23:07:10 +0000 Subject: [PATCH] Replaced assert( IsValid() ) with checker's call to IsValid. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1024 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/LevelMutex.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/include/loki/LevelMutex.h b/include/loki/LevelMutex.h index c048000..9afb4ca 100644 --- a/include/loki/LevelMutex.h +++ b/include/loki/LevelMutex.h @@ -280,8 +280,9 @@ protected: { public: inline explicit Checker( const volatile LevelMutexInfo * mutex ) : - m_mutex( mutex ) {} - inline ~Checker( void ) { m_mutex->IsValid(); } + m_mutex( mutex ) { Check(); } + inline ~Checker( void ) { Check(); } + inline bool Check( void ) const { return m_mutex->IsValid(); } private: Checker( void ); Checker( const Checker & ); @@ -782,7 +783,6 @@ public: virtual MutexErrors::Type TryLock( void ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( true ); @@ -804,7 +804,6 @@ public: virtual MutexErrors::Type Lock( void ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); @@ -824,7 +823,6 @@ public: virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false ); @@ -860,7 +858,6 @@ public: virtual MutexErrors::Type Unlock( void ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) MutexErrors::Type result = LevelMutexInfo::PreUnlockCheck(); @@ -906,7 +903,6 @@ private: */ virtual MutexErrors::Type LockThis( void ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) assert( this != LevelMutexInfo::GetCurrentMutex() ); @@ -927,7 +923,6 @@ private: */ virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile { - assert( IsValid() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) clock_t timeOut = clock() + milliSeconds; @@ -953,9 +948,8 @@ private: */ virtual MutexErrors::Type UnlockThis( void ) volatile { - assert( IsValid() ); - assert( NULL != LevelMutexInfo::GetCurrentMutex() ); LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; ) + assert( NULL != LevelMutexInfo::GetCurrentMutex() ); if ( 1 < LevelMutexInfo::GetLockCount() ) {