Add mtx_owned() implementation.

MFC after:	2 weeks
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
This commit is contained in:
pjd 2010-08-27 13:58:38 +00:00
parent 29f3bd82d2
commit ef9c1a15b4

View File

@ -33,7 +33,9 @@
#define _SYNCH_H_
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <pthread_np.h>
#include <stdbool.h>
#include <time.h>
@ -70,6 +72,12 @@ mtx_unlock(pthread_mutex_t *lock)
error = pthread_mutex_unlock(lock);
assert(error == 0);
}
static __inline bool
mtx_owned(pthread_mutex_t *lock)
{
return (pthread_mutex_isowned_np(lock) != 0);
}
static __inline void
rw_init(pthread_rwlock_t *lock)