diff options
author | jb <jb@FreeBSD.org> | 1998-11-15 10:01:34 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-11-15 10:01:34 +0000 |
commit | 244d5ffe0ed38a7760260c0ad3f3963b730b580c (patch) | |
tree | 66696e7bcfbe86fc8ad50714d66c8a25963a1c61 /lib/libc_r/uthread | |
parent | 3715314d366a89dbd7df6124d745c95e1bdde448 (diff) | |
download | FreeBSD-src-244d5ffe0ed38a7760260c0ad3f3963b730b580c.zip FreeBSD-src-244d5ffe0ed38a7760260c0ad3f3963b730b580c.tar.gz |
Interrupt threads waiting in select etc.
Submitted by: Alec Wolman <wolman@cs.washington.edu>
Diffstat (limited to 'lib/libc_r/uthread')
-rw-r--r-- | lib/libc_r/uthread/uthread_kill.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/uthread_kill.c b/lib/libc_r/uthread/uthread_kill.c index 292ba5c..7572c05 100644 --- a/lib/libc_r/uthread/uthread_kill.c +++ b/lib/libc_r/uthread/uthread_kill.c @@ -83,6 +83,26 @@ pthread_kill(pthread_t pthread, int sig) sigaddset(&pthread->sigpend,sig); break; + case PS_SELECT_WAIT: + case PS_FDR_WAIT: + case PS_FDW_WAIT: + case PS_SLEEP_WAIT: + if (!sigismember(&pthread->sigmask, sig) && + (_thread_sigact[sig - 1].sa_handler != SIG_IGN)) { + /* Flag the operation as interrupted: */ + pthread->interrupted = 1; + + /* 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); + } + break; + default: /* Increment the pending signal count: */ sigaddset(&pthread->sigpend,sig); |