18 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
36 class Mutex::MutexImpl
45 MutexImpl(
const MutexImpl& );
46 MutexImpl& operator=(
const MutexImpl& );
48 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
49 CRITICAL_SECTION m_cs;
50 #elif defined( HAVE_PTHREAD )
51 pthread_mutex_t m_mutex;
56 Mutex::MutexImpl::MutexImpl()
58 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
59 InitializeCriticalSection( &m_cs );
60 #elif defined( HAVE_PTHREAD )
61 pthread_mutex_init( &m_mutex, 0 );
65 Mutex::MutexImpl::~MutexImpl()
67 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
68 DeleteCriticalSection( &m_cs );
69 #elif defined( HAVE_PTHREAD )
70 pthread_mutex_destroy( &m_mutex );
76 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
77 EnterCriticalSection( &m_cs );
78 #elif defined( HAVE_PTHREAD )
79 pthread_mutex_lock( &m_mutex );
85 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
86 return TryEnterCriticalSection( &m_cs ) ?
true :
false;
87 #elif defined( HAVE_PTHREAD )
88 return !( pthread_mutex_trylock( &m_mutex ) );
96 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
97 LeaveCriticalSection( &m_cs );
98 #elif defined( HAVE_PTHREAD )
99 pthread_mutex_unlock( &m_mutex );
104 : m_mutex( new MutexImpl() )
120 return m_mutex->trylock();