From 0957bb7d29fc1db36c083643a55e563482f86f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 6 Feb 2008 20:44:29 +0000 Subject: [PATCH] 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(+) diff --git a/lib/libkse/kse.map b/lib/libkse/kse.map index 94f6dd958188..a6eed6980e67 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 f6b0e245c332..a2a7ed5d381c 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); +} +