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
lib
libc_r/uthread
libkse/thread
libpthread/thread
@ -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…
x
Reference in New Issue
Block a user