From 6fdfcacb4a7a4a9f24e9c5c8c76a85d0ab5dc99a Mon Sep 17 00:00:00 2001 From: David Xu Date: Wed, 21 Nov 2007 05:21:58 +0000 Subject: Remove umtx_t definition, use type long directly, add wrapper function _thr_umtx_wait_uint() for umtx operation UMTX_OP_WAIT_UINT, use the function in semaphore operations, this fixed compiler warnings. --- lib/libthr/thread/thr_umtx.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/libthr/thread/thr_umtx.c') 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) -- cgit v1.2.3