private extern class NativePthreadMutex in "C" `{ pthread_mutex_t * `}
new (attr: NativePthreadMutexAttr) `{
pthread_mutex_t *mutex = malloc(sizeof(pthread_mutex_t));
int r = pthread_mutex_init(mutex, attr);
if (r != 0) {
free(mutex);
return NULL;
}
return mutex;
`}
fun destroy `{ pthread_mutex_destroy(self); `}
fun lock `{ pthread_mutex_lock(self); `}
fun try_lock: Bool `{ return pthread_mutex_trylock(self); `}
fun unlock `{ pthread_mutex_unlock(self); `}
end
lib/pthreads/pthreads.nit:210,1--226,3