Date: Mon, 02 Jul 2012 13:09:38 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r238801 - in soc2012/gmiller/locking-head: . lib/libwitness Message-ID: <20120702130938.A0DF8106567C@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gmiller Date: Mon Jul 2 13:09:38 2012 New Revision: 238801 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238801 Log: r238614@FreeBSD-dev: root | 2012-06-29 14:49:12 -0500 Add wrappers for the remaining mutex locking functions. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:28 2012 (r238800) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:38 2012 (r238801) @@ -28,6 +28,9 @@ #include "witness.h" int _pthread_mutex_lock(pthread_mutex_t *mutex); +int _pthread_mutex_trylock(pthread_mutex_t *mutex); +int _pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *ts); int _pthread_mutex_unlock(pthread_mutex_t *mutex); pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -46,6 +49,32 @@ } int +pthread_mutex_trylock(pthread_mutex_t *mutex) +{ + int ret; + + ret = _pthread_mutex_trylock(mutex); + if (mutex != &witness_mtx && ret == 0) { + add_lock(mutex); + } + + return (ret); +} + +int +pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *ts) +{ + int ret; + + ret = _pthread_mutex_timedlock(mutex, ts); + if (mutex != &witness_mtx && ret == 0) { + add_lock(mutex); + } + + return (ret); +} + +int pthread_mutex_unlock(pthread_mutex_t *mutex) { int ret;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120702130938.A0DF8106567C>