diff options
author | David Xu <davidxu@FreeBSD.org> | 2007-11-21 05:21:58 +0000 |
---|---|---|
committer | David Xu <davidxu@FreeBSD.org> | 2007-11-21 05:21:58 +0000 |
commit | 6fdfcacb4a7a4a9f24e9c5c8c76a85d0ab5dc99a (patch) | |
tree | bd92b4c6d4241b908fcaf1640e5cc6e419dc109b /lib/libthr/thread/thr_umtx.c | |
parent | 110de0cf17923839e434ead831b7a7c74a7ce102 (diff) |
Notes
Diffstat (limited to 'lib/libthr/thread/thr_umtx.c')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index 0a5ee6a31113..058205b52731 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -85,7 +85,7 @@ __thr_umutex_set_ceiling(struct umutex *mtx, uint32_t ceiling, } int -_thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout) +_thr_umtx_wait(volatile long *mtx, long id, const struct timespec *timeout) { if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 && timeout->tv_nsec <= 0))) @@ -97,7 +97,19 @@ _thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout) } int -_thr_umtx_wake(volatile umtx_t *mtx, int nr_wakeup) +_thr_umtx_wait_uint(volatile u_int *mtx, u_int id, const struct timespec *timeout) +{ + if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 && + timeout->tv_nsec <= 0))) + return (ETIMEDOUT); + if (_umtx_op(__DEVOLATILE(void *, mtx), UMTX_OP_WAIT_UINT, id, 0, + __DECONST(void*, timeout)) != -1) + return (0); + return (errno); +} + +int +_thr_umtx_wake(volatile void *mtx, int nr_wakeup) { if (_umtx_op(__DEVOLATILE(void *, mtx), UMTX_OP_WAKE, nr_wakeup, 0, 0) != -1) |