5 #include "mutex_private.h"
6 #include "systemerror.h"
14 InitializeCriticalSection(&priv->crit);
16 pthread_mutex_init(&priv->mutex, 0);
23 DeleteCriticalSection(&priv->crit);
25 pthread_mutex_destroy(&priv->mutex);
33 EnterCriticalSection(&priv->crit);
35 if(int err = pthread_mutex_lock(&priv->mutex))
36 throw system_error("Mutex::lock", err);
43 return TryEnterCriticalSection(&priv->crit);
45 int err = pthread_mutex_trylock(&priv->mutex);
47 throw system_error("Mutex::trylock", err);
55 LeaveCriticalSection(&priv->crit);
57 if(int err = pthread_mutex_unlock(&priv->mutex))
58 throw system_error("Mutex::unlock", err);