There's no need for _umtxtrylock to be a separate function.

Roll it into the pre-existing macro that's used to call it.
This commit is contained in:
mtm 2003-07-06 10:10:32 +00:00
parent b505b0da1e
commit d4808894e4
3 changed files with 8 additions and 13 deletions

View File

@ -80,7 +80,8 @@ _pthread_cancel(pthread_t pthread)
* 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;
}

View File

@ -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_

View File

@ -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