diff options
Diffstat (limited to 'lib/libthr')
-rw-r--r-- | lib/libthr/thread/thr_cancel.c | 3 | ||||
-rw-r--r-- | lib/libthr/thread/thr_private.h | 8 | ||||
-rw-r--r-- | lib/libthr/thread/thr_spinlock.c | 10 |
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 |