summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutex.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_mutex.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_mutex.c')
-rw-r--r--lib/libthr/thread/thr_mutex.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 722772b..ec0ffc9 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -1284,20 +1284,7 @@ _mutex_lock_backout(pthread_t pthread)
{
struct pthread_mutex *mutex;
- /*
- * Defer signals to protect the scheduling queues from
- * access by the signal handler:
- */
- /* _thread_kern_sig_defer();*/
-
- /* XXX - Necessary to obey lock order */
- UMTX_LOCK(&pthread->lock);
mutex = pthread->data.mutex;
- UMTX_UNLOCK(&pthread->lock);
-
- _SPINLOCK(&mutex->lock);
-
- _thread_critical_enter(pthread);
if ((pthread->flags & PTHREAD_FLAGS_IN_MUTEXQ) != 0) {
mutex_queue_remove(mutex, pthread);
@@ -1306,14 +1293,6 @@ _mutex_lock_backout(pthread_t pthread)
pthread->data.mutex = NULL;
}
- /*
- * Undefer and handle pending signals, yielding if
- * necessary:
- */
- /* _thread_kern_sig_undefer(); */
-
- _thread_critical_exit(pthread);
- _SPINUNLOCK(&mutex->lock);
}
/*
@@ -1426,14 +1405,13 @@ get_mcontested(pthread_mutex_t mutexp)
{
int error;
- _thread_critical_enter(curthread);
-
/*
* Put this thread on the mutex's list of waiting threads.
* The lock on the thread ensures atomic (as far as other
* threads are concerned) setting of the thread state with
* it's status on the mutex queue.
*/
+ _thread_critical_enter(curthread);
mutex_queue_enq(mutexp, curthread);
do {
PTHREAD_SET_STATE(curthread, PS_MUTEX_WAIT);
@@ -1443,10 +1421,8 @@ get_mcontested(pthread_mutex_t mutexp)
error = _thread_suspend(curthread, NULL);
if (error != 0 && error != EAGAIN && error != EINTR)
PANIC("Cannot suspend on mutex.");
-
_SPINLOCK(&mutexp->lock);
_thread_critical_enter(curthread);
} while ((curthread->flags & PTHREAD_FLAGS_IN_MUTEXQ) != 0);
-
_thread_critical_exit(curthread);
}
OpenPOWER on IntegriCloud