aboutsummaryrefslogtreecommitdiff
path: root/lib/libc_r/uthread/uthread_sig.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2001-11-17 14:28:39 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2001-11-17 14:28:39 +0000
commitccc7b69205d48bc890a1565811ef265a7904977c (patch)
treed9b490926b6ae401659e2052a1b89c5bea09c6d4 /lib/libc_r/uthread/uthread_sig.c
parent608f31f640fa809e3d3f91a58b0bcbe10e125267 (diff)
downloadsrc-ccc7b69205d48bc890a1565811ef265a7904977c.tar.gz
src-ccc7b69205d48bc890a1565811ef265a7904977c.zip
Fix pthread_join so that it works if the target thread exits while
the joining thread is in a signal handler. Reported by: Loren James Rittle <rittle@labs.mot.com> MFC after: 1 week
Notes
Notes: svn path=/head/; revision=86499
Diffstat (limited to 'lib/libc_r/uthread/uthread_sig.c')
-rw-r--r--lib/libc_r/uthread/uthread_sig.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c
index 9ca197efdbec..a05f9145b8df 100644
--- a/lib/libc_r/uthread/uthread_sig.c
+++ b/lib/libc_r/uthread/uthread_sig.c
@@ -671,7 +671,6 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
* signal handler to run:
*/
case PS_COND_WAIT:
- case PS_JOIN:
case PS_MUTEX_WAIT:
/*
* Remove the thread from the wait queue. It will
@@ -681,6 +680,17 @@ thread_sig_add(pthread_t pthread, int sig, int has_args)
PTHREAD_WAITQ_REMOVE(pthread);
break;
+ case PS_JOIN:
+ /*
+ * Remove the thread from the wait queue. It will
+ * be added back to the wait queue once all signal
+ * handlers have been invoked.
+ */
+ PTHREAD_WAITQ_REMOVE(pthread);
+ /* Make the thread runnable: */
+ PTHREAD_SET_STATE(pthread, PS_RUNNING);
+ break;
+
/*
* States which are interruptible but may need to be removed
* from queues before any signal handler is called.