|
|
|
@ -112,22 +112,25 @@ WXMP_Result void_wResult;
|
|
|
|
|
// ! Would be OK but overkill to specify PTHREAD_MUTEX_RECURSIVE.
|
|
|
|
|
|
|
|
|
|
bool XMP_InitMutex ( XMP_Mutex * mutex ) {
|
|
|
|
|
int err = pthread_mutex_init ( mutex, 0 );
|
|
|
|
|
return (err == 0 );
|
|
|
|
|
// int err = pthread_mutex_init ( mutex, 0 );
|
|
|
|
|
// return (err == 0 );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XMP_TermMutex ( XMP_Mutex & mutex ) {
|
|
|
|
|
(void) pthread_mutex_destroy ( &mutex );
|
|
|
|
|
// (void) pthread_mutex_destroy ( &mutex );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XMP_EnterCriticalRegion ( XMP_Mutex & mutex ) {
|
|
|
|
|
int err = pthread_mutex_lock ( &mutex );
|
|
|
|
|
if ( err != 0 ) XMP_Throw ( "XMP_EnterCriticalRegion - pthread_mutex_lock failure", kXMPErr_ExternalFailure );
|
|
|
|
|
// int err = pthread_mutex_lock ( &mutex );
|
|
|
|
|
// if ( err != 0 ) XMP_Throw ( "XMP_EnterCriticalRegion - pthread_mutex_lock failure", kXMPErr_ExternalFailure );
|
|
|
|
|
mutex.lock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XMP_ExitCriticalRegion ( XMP_Mutex & mutex ) {
|
|
|
|
|
int err = pthread_mutex_unlock ( &mutex );
|
|
|
|
|
if ( err != 0 ) XMP_Throw ( "XMP_ExitCriticalRegion - pthread_mutex_unlock failure", kXMPErr_ExternalFailure );
|
|
|
|
|
// int err = pthread_mutex_unlock ( &mutex );
|
|
|
|
|
// if ( err != 0 ) XMP_Throw ( "XMP_ExitCriticalRegion - pthread_mutex_unlock failure", kXMPErr_ExternalFailure );
|
|
|
|
|
mutex.unlock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|