diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-05-26 00:18:27 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-05-26 00:18:27 +0000 |
commit | ce75e095891d0e7855c5b4c94f24393cf7c2b610 (patch) | |
tree | d4a6264e2baa2c3ecbb2de438c063ad6883e6078 /lib/libpthread/uthread/uthread_kill.c | |
parent | 8fd8f5d111ec2aa383bf3a5dd4a7f0394d0f9f57 (diff) |
sync with FreeBSD
Diffstat (limited to 'lib/libpthread/uthread/uthread_kill.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_kill.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_kill.c b/lib/libpthread/uthread/uthread_kill.c index 132dea74464..dc698ff1660 100644 --- a/lib/libpthread/uthread/uthread_kill.c +++ b/lib/libpthread/uthread/uthread_kill.c @@ -1,3 +1,4 @@ +/* $OpenBSD: uthread_kill.c,v 1.6 1999/05/26 00:18:24 d Exp $ */ /* * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -29,7 +30,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: uthread_kill.c,v 1.5 1999/01/06 05:29:24 d Exp $ */ #include <errno.h> #include <signal.h> @@ -53,6 +53,13 @@ pthread_kill(pthread_t pthread, int sig) /* Find the thread in the list of active threads: */ else if ((ret = _find_thread(pthread)) == 0) { + /* + * Guard against preemption by a scheduling signal. + * A change of thread state modifies the waiting + * and priority queues. + */ + _thread_kern_sched_defer(); + switch (pthread->state) { case PS_SIGSUSPEND: /* @@ -109,6 +116,12 @@ pthread_kill(pthread_t pthread, int sig) sigaddset(&pthread->sigpend,sig); break; } + + /* + * Reenable preemption and yield if a scheduling signal + * occurred while in the critical region. + */ + _thread_kern_sched_undefer(); } /* Return the completion status: */ |