summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_umtx.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_umtx.h')
-rw-r--r--lib/libthr/thread/thr_umtx.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_umtx.h b/lib/libthr/thread/thr_umtx.h
index a0f331a..8696320 100644
--- a/lib/libthr/thread/thr_umtx.h
+++ b/lib/libthr/thread/thr_umtx.h
@@ -65,6 +65,14 @@ _thr_umutex_trylock(struct umutex *mtx, uint32_t id)
}
static inline int
+_thr_umutex_trylock2(struct umutex *mtx, uint32_t id)
+{
+ if (atomic_cmpset_acq_32(&mtx->m_owner, UMUTEX_UNOWNED, id))
+ return (0);
+ return (EBUSY);
+}
+
+static inline int
_thr_umutex_lock(struct umutex *mtx, uint32_t id)
{
if (atomic_cmpset_acq_32(&mtx->m_owner, UMUTEX_UNOWNED, id))
OpenPOWER on IntegriCloud