34 pthread_mutexattr_init(&
m_attr);
35 pthread_mutexattr_settype(&
m_attr, type);
41 pthread_mutex_destroy( &
m_mutex );
42 pthread_mutexattr_destroy(&
m_attr);
47 int ret = pthread_mutex_trylock( &
m_mutex );
55 throw MutexException(
"The mutex could not be acquired because it was already locked.");
62 switch (pthread_mutex_lock( &
m_mutex ))
73 throw MutexException(
"The mutex could not be acquired because it was already locked.");
78 throw MutexException(
"The value specified by mutex does not refer to an initialised mutex object.");
81 throw MutexException(
"The mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded.");
86 throw MutexException(
"The current thread already owns the mutex.");
91 throw MutexException(
"The current thread does not own the mutex.");
94 throw MutexException(
"can not lock the mutex");
100 if (0 != pthread_mutex_unlock( &
m_mutex ))
102 throw MutexException(
"can not unlock mutex");