summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_spinlock.c
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-12-09 11:12:11 +0000
committermtm <mtm@FreeBSD.org>2003-12-09 11:12:11 +0000
commit5f32d90edd66b839d09271c56ca3d2e3ff04624a (patch)
tree8acaa952bf900222012b86ff5e6540e2feb6b6bc /lib/libthr/thread/thr_spinlock.c
parentbc6b622cf64270f3ae017698e25018a5687802ad (diff)
downloadFreeBSD-src-5f32d90edd66b839d09271c56ca3d2e3ff04624a.zip
FreeBSD-src-5f32d90edd66b839d09271c56ca3d2e3ff04624a.tar.gz
Fix the wrapper function around signals so that a signal handling
thread on one of the mutex or condition variable queues is removed from those queues before the real signal handler is called.
Diffstat (limited to 'lib/libthr/thread/thr_spinlock.c')
-rw-r--r--lib/libthr/thread/thr_spinlock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c
index 259977a..322d2e7 100644
--- a/lib/libthr/thread/thr_spinlock.c
+++ b/lib/libthr/thread/thr_spinlock.c
@@ -64,6 +64,17 @@ _spinlock(spinlock_t *lck)
abort();
}
+int
+_spintrylock(spinlock_t *lck)
+{
+ int error;
+
+ error = umtx_lock((struct umtx *)lck, curthread->thr_id);
+ if (error != 0 && error != EBUSY)
+ abort();
+ return (error);
+}
+
/*
* Lock a location for the running thread. Yield to allow other
* threads to run if this thread is blocked because the lock is
OpenPOWER on IntegriCloud