mirror of
https://github.com/opnsense/src.git
synced 2026-04-29 18:32:49 -04:00
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. This bug was found by Butenhof's cancel_subcontract test. Reviewed by: jasone
This commit is contained in:
parent
b4db911dc6
commit
320bfcf3f1
3 changed files with 3 additions and 12 deletions
|
|
@ -65,14 +65,11 @@ _pthread_cancel(pthread_t pthread)
|
|||
|
||||
case PS_JOIN:
|
||||
/*
|
||||
* Disconnect the thread from the joinee and
|
||||
* detach:
|
||||
* Disconnect the thread from the joinee:
|
||||
*/
|
||||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread_detach((pthread_t)
|
||||
pthread->join_status.thread);
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
|
|
@ -65,14 +65,11 @@ _pthread_cancel(pthread_t pthread)
|
|||
|
||||
case PS_JOIN:
|
||||
/*
|
||||
* Disconnect the thread from the joinee and
|
||||
* detach:
|
||||
* Disconnect the thread from the joinee:
|
||||
*/
|
||||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread_detach((pthread_t)
|
||||
pthread->join_status.thread);
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
|
|
@ -65,14 +65,11 @@ _pthread_cancel(pthread_t pthread)
|
|||
|
||||
case PS_JOIN:
|
||||
/*
|
||||
* Disconnect the thread from the joinee and
|
||||
* detach:
|
||||
* Disconnect the thread from the joinee:
|
||||
*/
|
||||
if (pthread->join_status.thread != NULL) {
|
||||
pthread->join_status.thread->joiner
|
||||
= NULL;
|
||||
pthread_detach((pthread_t)
|
||||
pthread->join_status.thread);
|
||||
}
|
||||
pthread->cancelflags |= PTHREAD_CANCELLING;
|
||||
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
|
||||
|
|
|
|||
Loading…
Reference in a new issue