diff options
author | jb <jb@FreeBSD.org> | 1998-08-25 11:19:14 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-08-25 11:19:14 +0000 |
commit | cf45fb770c2b87b25fcb5d6e81d0bd3019a3a8ab (patch) | |
tree | 98b59273b5d1e9acec0ca135dcbf60b20def8503 /lib/libpthread/thread/thr_kill.c | |
parent | ea89bf50f38a87b164620850cd5d68aee7ca050d (diff) | |
download | FreeBSD-src-cf45fb770c2b87b25fcb5d6e81d0bd3019a3a8ab.zip FreeBSD-src-cf45fb770c2b87b25fcb5d6e81d0bd3019a3a8ab.tar.gz |
Fix for sigwait problem.
Submitted by: Daniel M. Eischen <eischen@vigrid.com>
PR: misc/7039
Diffstat (limited to 'lib/libpthread/thread/thr_kill.c')
-rw-r--r-- | lib/libpthread/thread/thr_kill.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_kill.c b/lib/libpthread/thread/thr_kill.c index f6e684b..98b3a2d 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); |