summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-07-06 10:10:32 +0000
committermtm <mtm@FreeBSD.org>2003-07-06 10:10:32 +0000
commitd4808894e4846559ec5d35948da89927a1034b33 (patch)
tree5cafa78cb831b87996f103105197dbac29bf9d58 /lib/libthr
parentb505b0da1eee42e0ad971581478b7a0637a486ec (diff)
downloadFreeBSD-src-d4808894e4846559ec5d35948da89927a1034b33.zip
FreeBSD-src-d4808894e4846559ec5d35948da89927a1034b33.tar.gz
There's no need for _umtxtrylock to be a separate function.
Roll it into the pre-existing macro that's used to call it.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_cancel.c3
-rw-r--r--lib/libthr/thread/thr_private.h8
-rw-r--r--lib/libthr/thread/thr_spinlock.c10
3 files changed, 8 insertions, 13 deletions
diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c
index 311cf1e..180607c 100644
--- a/lib/libthr/thread/thr_cancel.c
+++ b/lib/libthr/thread/thr_cancel.c
@@ -80,7 +80,8 @@ retry:
* Disconnect the thread from the joinee:
*/
if ((joined = pthread->join_status.thread) != NULL) {
- if (THR_TRYLOCK(&joined->lock) == EBUSY) {
+ THR_TRYLOCK(&joined->lock, ret);
+ if (ret == EBUSY) {
_thread_critical_exit(pthread);
goto retry;
}
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index dd5f543..9b118b9 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -89,7 +89,12 @@
abort(); \
} while (0)
-#define THR_TRYLOCK(m) _umtxtrylock((m))
+#define THR_TRYLOCK(m, r) \
+ do { \
+ (r) = umtx_trylock((m), curthread->thr_id); \
+ if ((r) != 0 && (r) != EBUSY) \
+ abort(); \
+ } while (0)
#define THR_UNLOCK(m) \
do { \
@@ -785,7 +790,6 @@ void _thread_critical_enter(pthread_t);
void _thread_critical_exit(pthread_t);
void _thread_sigblock();
void _thread_sigunblock();
-int _umtxtrylock(struct umtx *lck);
/* #include <sys/aio.h> */
#ifdef _SYS_AIO_H_
diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c
index dcb6fac..259977a 100644
--- a/lib/libthr/thread/thr_spinlock.c
+++ b/lib/libthr/thread/thr_spinlock.c
@@ -64,16 +64,6 @@ _spinlock(spinlock_t *lck)
abort();
}
-int
-_umtxtrylock(struct umtx *lck)
-{
- int error;
- error = umtx_trylock(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