summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2005-07-28 03:34:54 +0000
committerdavidxu <davidxu@FreeBSD.org>2005-07-28 03:34:54 +0000
commitdc3be45bb968f75ac7b8c3d457dcabf10b6d0c72 (patch)
tree669f2101edbca78d0edd5280130f7e22b2e8191f /lib
parent4bb68a8b051e81b18f168b23d7662d8d37f0990d (diff)
downloadFreeBSD-src-dc3be45bb968f75ac7b8c3d457dcabf10b6d0c72.zip
FreeBSD-src-dc3be45bb968f75ac7b8c3d457dcabf10b6d0c72.tar.gz
Cast to uintptr_t to avoid compiler warning, it was broken by
the recent atomic_ptr() change.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_umtx.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_umtx.h b/lib/libthr/thread/thr_umtx.h
index 4ccfb69..8d2718d 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);
}
OpenPOWER on IntegriCloud