From 2ff77b92202abdf10ab3f2434ac25719083ebeeb Mon Sep 17 00:00:00 2001 From: David Xu Date: Thu, 28 Jul 2005 03:34:54 +0000 Subject: [PATCH] Cast to uintptr_t to avoid compiler warning, it was broken by the recent atomic_ptr() change. --- lib/libthr/thread/thr_umtx.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/libthr/thread/thr_umtx.h b/lib/libthr/thread/thr_umtx.h index 4ccfb69c6ed..8d2718dc47f 100644 --- a/lib/libthr/thread/thr_umtx.h +++ b/lib/libthr/thread/thr_umtx.h @@ -47,30 +47,36 @@ _thr_umtx_init(volatile umtx_t *mtx) static inline int _thr_umtx_trylock(volatile umtx_t *mtx, long id) { - return umtx_trylock((struct umtx *)mtx, id); + if (atomic_cmpset_acq_ptr((volatile uintptr_t *)mtx, + (uintptr_t)UMTX_UNOWNED, (uintptr_t)id)) + return (0); + return (EBUSY); } static inline int _thr_umtx_lock(volatile umtx_t *mtx, long id) { - if (atomic_cmpset_acq_ptr(mtx, (void *)UMTX_UNOWNED, (void *)id)) + if (atomic_cmpset_acq_ptr((volatile uintptr_t *)mtx, + (uintptr_t)UMTX_UNOWNED, (uintptr_t)id)) return (0); - return __thr_umtx_lock(mtx, id); + return (__thr_umtx_lock(mtx, id)); } static inline int _thr_umtx_timedlock(volatile umtx_t *mtx, long id, const struct timespec *timeout) { - if (atomic_cmpset_acq_ptr(mtx, (void *)UMTX_UNOWNED, (void *)id)) + if (atomic_cmpset_acq_ptr((volatile uintptr_t *)mtx, + (uintptr_t)UMTX_UNOWNED, (uintptr_t)id)) return (0); - return __thr_umtx_timedlock(mtx, id, timeout); + return (__thr_umtx_timedlock(mtx, id, timeout)); } static inline int _thr_umtx_unlock(volatile umtx_t *mtx, long id) { - if (atomic_cmpset_rel_ptr(mtx, (void *)id, (void *)UMTX_UNOWNED)) + if (atomic_cmpset_rel_ptr((volatile uintptr_t *)mtx, + (uintptr_t)id, (uintptr_t)UMTX_UNOWNED)) return (0); return __thr_umtx_unlock(mtx, id); }