diff options
author | deischen <deischen@FreeBSD.org> | 2003-04-29 21:03:33 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-04-29 21:03:33 +0000 |
commit | 6bd4376dc86f246ff07451d32eeeab0742747649 (patch) | |
tree | 91af310836f600ff861fcc771d66919156ee5215 /lib/libpthread/thread/thr_sig.c | |
parent | eeceed0838e543d6948276df87b878354ca10adb (diff) | |
download | FreeBSD-src-6bd4376dc86f246ff07451d32eeeab0742747649.zip FreeBSD-src-6bd4376dc86f246ff07451d32eeeab0742747649.tar.gz |
Create the thread signal lock as a KSE lock (as opposed to
a thread lock).
Better protect access to thread state while searching for
threads to handle a signal.
Better protect access to process pending signals while processing
a thread in sigwait().
Submitted by: davidxu
Diffstat (limited to 'lib/libpthread/thread/thr_sig.c')
-rw-r--r-- | lib/libpthread/thread/thr_sig.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c index 5ac4998..cd699db 100644 --- a/lib/libpthread/thread/thr_sig.c +++ b/lib/libpthread/thread/thr_sig.c @@ -286,11 +286,10 @@ thr_sig_find(struct kse *curkse, int sig, siginfo_t *info) KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock); TAILQ_FOREACH(pthread, &_thread_list, tle) { + /* Take the scheduling lock. */ + KSE_SCHED_LOCK(curkse, pthread->kseg); if ((pthread->state == PS_SIGWAIT) && sigismember(pthread->data.sigwait, sig)) { - /* Take the scheduling lock. */ - KSE_SCHED_LOCK(curkse, pthread->kseg); - /* * Return the signal number and make the * thread runnable. @@ -328,6 +327,7 @@ thr_sig_find(struct kse *curkse, int sig, siginfo_t *info) } else if (signaled_thread == NULL) signaled_thread = pthread; } + KSE_SCHED_UNLOCK(curkse, pthread->kseg); } KSE_LOCK_RELEASE(curkse, &_thread_list_lock); |