From b4e1ea3e1cc947e4e8afdce157a35e5fa08e8276 Mon Sep 17 00:00:00 2001 From: des Date: Wed, 6 Feb 2008 20:44:29 +0000 Subject: Add pthread_mutex_isowned_np() here as well; libthr and libkse are supposed to have identical functionality. MFC after: 2 weeks --- lib/libkse/kse.map | 5 +++++ lib/libkse/thread/thr_mutex.c | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/libkse/kse.map b/lib/libkse/kse.map index 94f6dd9..a6eed69 100644 --- a/lib/libkse/kse.map +++ b/lib/libkse/kse.map @@ -256,6 +256,7 @@ FBSDprivate_1.0 { _pthread_mutex_getprioceiling; _pthread_mutex_init; _pthread_mutex_init_calloc_cb; + _pthread_mutex_isowned_np; _pthread_mutex_lock; _pthread_mutex_setprioceiling; _pthread_mutex_timedlock; @@ -360,3 +361,7 @@ FBSDprivate_1.0 { _thread_state_running; _thread_state_zoombie; }; + +FBSD_1.1 { + pthread_mutex_isowned_np; +}; diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c index f6b0e24..a2a7ed5 100644 --- a/lib/libkse/thread/thr_mutex.c +++ b/lib/libkse/thread/thr_mutex.c @@ -110,6 +110,7 @@ __weak_reference(__pthread_mutex_trylock, pthread_mutex_trylock); /* No difference between libc and application usage of these: */ __weak_reference(_pthread_mutex_destroy, pthread_mutex_destroy); __weak_reference(_pthread_mutex_unlock, pthread_mutex_unlock); +__weak_reference(_pthread_mutex_isowned_np, pthread_mutex_isowned_np); static int thr_mutex_init(pthread_mutex_t *mutex, @@ -1849,3 +1850,12 @@ mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread) } pthread->sflags |= THR_FLAGS_IN_SYNCQ; } + +int +_pthread_mutex_isowned_np(pthread_mutex_t *mutex) +{ + struct pthread *curthread = _get_curthread(); + + return ((*mutex)->m_owner == curthread); +} + -- cgit v1.1