diff options
author | davidxu <davidxu@FreeBSD.org> | 2008-04-29 03:58:18 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2008-04-29 03:58:18 +0000 |
commit | 0e9d39ae8fb92317d5c01b606a5921f9b24b18f8 (patch) | |
tree | 526d411e9fd9b2fd964f111c6dd882d1ab4a5096 /lib/libthr/thread/thr_umtx.c | |
parent | e43b7bfc16592e8563de4f6f5e200878f9efa80c (diff) | |
download | FreeBSD-src-0e9d39ae8fb92317d5c01b606a5921f9b24b18f8.zip FreeBSD-src-0e9d39ae8fb92317d5c01b606a5921f9b24b18f8.tar.gz |
Use UMTX_OP_WAIT_UINT_PRIVATE and UMTX_OP_WAKE_PRIVATE to save
time in kernel(avoid VM lookup).
Diffstat (limited to 'lib/libthr/thread/thr_umtx.c')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index ff8c60e..3efe884 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -94,19 +94,20 @@ _thr_umtx_wait(volatile long *mtx, long id, const struct timespec *timeout) } int -_thr_umtx_wait_uint(volatile u_int *mtx, u_int id, const struct timespec *timeout) +_thr_umtx_wait_uint(volatile u_int *mtx, u_int id, const struct timespec *timeout, int shared) { if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 && timeout->tv_nsec <= 0))) return (ETIMEDOUT); - return _umtx_op_err(__DEVOLATILE(void *, mtx), UMTX_OP_WAIT_UINT, id, 0, - __DECONST(void*, timeout)); + return _umtx_op_err(__DEVOLATILE(void *, mtx), + shared ? UMTX_OP_WAIT_UINT : UMTX_OP_WAIT_UINT_PRIVATE, id, 0, + __DECONST(void*, timeout)); } int -_thr_umtx_wake(volatile void *mtx, int nr_wakeup) +_thr_umtx_wake(volatile void *mtx, int nr_wakeup, int shared) { - return _umtx_op_err(__DEVOLATILE(void *, mtx), UMTX_OP_WAKE, + return _umtx_op_err(__DEVOLATILE(void *, mtx), shared ? UMTX_OP_WAKE : UMTX_OP_WAKE_PRIVATE, nr_wakeup, 0, 0); } |