summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_kill.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-08-25 11:19:14 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-08-25 11:19:14 +0000
commit42f37683ee32f4be3738b0c625b253cb983d6a08 (patch)
tree6109c166c8fc6bd047f72e97aea8006852cb344d /lib/libpthread/thread/thr_kill.c
parent5520d4646ec6a0aded820ca9d430ac2161658d94 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_kill.c')
-rw-r--r--lib/libpthread/thread/thr_kill.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_kill.c b/lib/libpthread/thread/thr_kill.c
index f6e684b0d4b5..98b3a2d39b90 100644
--- a/lib/libpthread/thread/thr_kill.c
+++ b/lib/libpthread/thread/thr_kill.c
@@ -47,9 +47,18 @@ pthread_kill(pthread_t pthread, int sig)
ret = EINVAL;
/* Find the thread in the list of active threads: */
- else if ((ret = _find_thread(pthread)) == 0)
- /* Increment the pending signal count: */
- sigaddset(&pthread->sigpend,sig);
+ else if ((ret = _find_thread(pthread)) == 0) {
+ if ((pthread->state == PS_SIGWAIT) &&
+ sigismember(&pthread->sigmask, sig)) {
+ /* Change the state of the thread to run: */
+ PTHREAD_NEW_STATE(pthread,PS_RUNNING);
+
+ /* Return the signal number: */
+ pthread->signo = sig;
+ } else
+ /* Increment the pending signal count: */
+ sigaddset(&pthread->sigpend,sig);
+ }
/* Return the completion status: */
return (ret);