summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_spinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_spinlock.c')
-rw-r--r--lib/libthr/thread/thr_spinlock.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c
index ff9b9e0..0f9cb6b 100644
--- a/lib/libthr/thread/thr_spinlock.c
+++ b/lib/libthr/thread/thr_spinlock.c
@@ -69,6 +69,16 @@ _spinlock(spinlock_t *lck)
_spinlock_pthread(curthread, lck);
}
+int
+_spintrylock(spinlock_t *lck)
+{
+ int error;
+ error = umtx_trylock((struct umtx *)lck, curthread->thr_id);
+ if (error != 0 && error != EBUSY)
+ abort();
+ return (error);
+}
+
inline void
_spinlock_pthread(pthread_t pthread, spinlock_t *lck)
{
OpenPOWER on IntegriCloud