mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 09:11:07 -04:00
Properly clear the status of a join operation if the joining thread is
canceled or the joinee is detached.
This commit is contained in:
parent
a370851f6e
commit
ca4b2c1a79
6 changed files with 12 additions and 3 deletions
|
|
@ -70,6 +70,7 @@ _pthread_cancel(pthread_t pthread)
|
|||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread->join_status.thread = NULL;
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ _pthread_detach(pthread_t pthread)
|
|||
PTHREAD_NEW_STATE(joiner, PS_RUNNING);
|
||||
|
||||
/* Set the return value for the woken thread: */
|
||||
joiner->error = ESRCH;
|
||||
joiner->join_status.error = ESRCH;
|
||||
joiner->join_status.ret = NULL;
|
||||
joiner->join_status.thread = NULL;
|
||||
|
||||
/*
|
||||
* Disconnect the joiner from the thread being detached:
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ _pthread_cancel(pthread_t pthread)
|
|||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread->join_status.thread = NULL;
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ _pthread_detach(pthread_t pthread)
|
|||
PTHREAD_NEW_STATE(joiner, PS_RUNNING);
|
||||
|
||||
/* Set the return value for the woken thread: */
|
||||
joiner->error = ESRCH;
|
||||
joiner->join_status.error = ESRCH;
|
||||
joiner->join_status.ret = NULL;
|
||||
joiner->join_status.thread = NULL;
|
||||
|
||||
/*
|
||||
* Disconnect the joiner from the thread being detached:
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ _pthread_cancel(pthread_t pthread)
|
|||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread->join_status.thread = NULL;
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ _pthread_detach(pthread_t pthread)
|
|||
PTHREAD_NEW_STATE(joiner, PS_RUNNING);
|
||||
|
||||
/* Set the return value for the woken thread: */
|
||||
joiner->error = ESRCH;
|
||||
joiner->join_status.error = ESRCH;
|
||||
joiner->join_status.ret = NULL;
|
||||
joiner->join_status.thread = NULL;
|
||||
|
||||
/*
|
||||
* Disconnect the joiner from the thread being detached:
|
||||
|
|
|
|||
Loading…
Reference in a new issue