@ -101,7 +101,7 @@ void PrintLockContention(const char* pszName, const char* pszFile, int nLine);
/** Wrapper around boost::unique_lock<Mutex> */
/** Wrapper around boost::unique_lock<Mutex> */
template < typename Mutex >
template < typename Mutex >
class CMutexLock
class SCOPED_LOCKABLE CMutexLock
{
{
private :
private :
boost : : unique_lock < Mutex > lock ;
boost : : unique_lock < Mutex > lock ;
@ -129,7 +129,7 @@ private:
}
}
public :
public :
CMutexLock ( Mutex & mutexIn , const char * pszName , const char * pszFile , int nLine , bool fTry = false ) : lock ( mutexIn , boost : : defer_lock )
CMutexLock ( Mutex & mutexIn , const char * pszName , const char * pszFile , int nLine , bool fTry = false ) EXCLUSIVE_LOCK_FUNCTION ( mutexIn ) : lock ( mutexIn , boost : : defer_lock )
{
{
if ( fTry )
if ( fTry )
TryEnter ( pszName , pszFile , nLine ) ;
TryEnter ( pszName , pszFile , nLine ) ;
@ -137,7 +137,7 @@ public:
Enter ( pszName , pszFile , nLine ) ;
Enter ( pszName , pszFile , nLine ) ;
}
}
CMutexLock ( Mutex * pmutexIn , const char * pszName , const char * pszFile , int nLine , bool fTry = false )
CMutexLock ( Mutex * pmutexIn , const char * pszName , const char * pszFile , int nLine , bool fTry = false ) EXCLUSIVE_LOCK_FUNCTION ( pmutexIn )
{
{
if ( ! pmutexIn ) return ;
if ( ! pmutexIn ) return ;
@ -148,7 +148,7 @@ public:
Enter ( pszName , pszFile , nLine ) ;
Enter ( pszName , pszFile , nLine ) ;
}
}
~ CMutexLock ( )
~ CMutexLock ( ) UNLOCK_FUNCTION ( )
{
{
if ( lock . owns_lock ( ) )
if ( lock . owns_lock ( ) )
LeaveCritical ( ) ;
LeaveCritical ( ) ;