diff options
author | 2001-12-20 07:50:08 +0000 | |
---|---|---|
committer | 2001-12-20 07:50:08 +0000 | |
commit | 55f3a0209961606d200ce9c99b83d287b4958b71 (patch) | |
tree | a1fbcffeb0e65463a5e2caa676be6ae97f821515 /lib/libpthread/uthread | |
parent | sync with freebsd. (diff) | |
download | wireguard-openbsd-55f3a0209961606d200ce9c99b83d287b4958b71.tar.xz wireguard-openbsd-55f3a0209961606d200ce9c99b83d287b4958b71.zip |
From FreeBSD:
When cancelling a thread while in a join operation, do not detach
the target thread of the join operation. This allows the cancelled
thread to detach the target thread in its cancellation handler.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_cancel.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libpthread/uthread/uthread_cancel.c b/lib/libpthread/uthread/uthread_cancel.c index 29f3a8edebf..594dce20d5a 100644 --- a/lib/libpthread/uthread/uthread_cancel.c +++ b/lib/libpthread/uthread/uthread_cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_cancel.c,v 1.9 2001/12/19 02:02:52 fgsch Exp $ */ +/* $OpenBSD: uthread_cancel.c,v 1.10 2001/12/20 07:50:08 fgsch Exp $ */ /* * David Leonard <d@openbsd.org>, 1999. Public domain. */ @@ -61,13 +61,11 @@ pthread_cancel(pthread) case PS_JOIN: /* - * Disconnect the thread from the joinee and - * detach: + * Disconnect the thread from the joinee: */ - if (pthread->data.thread != NULL) { - pthread->data.thread->joiner = NULL; - pthread_detach((pthread_t) - pthread->data.thread); + if (pthread->join_status.thread != NULL) { + pthread->join_status.thread->joiner + = NULL; } pthread->cancelflags |= PTHREAD_CANCELLING; PTHREAD_NEW_STATE(pthread, PS_RUNNING); |