If a thread was detached, return EINVAL instead, the error code

is also returned by pthread_detach() if a thread was already
detached, the error code was already documented:

>    [EINVAL]	The implementation has detected that the value speci-
>		fied by thread does not refer to a joinable thread.
This commit is contained in:
David Xu 2006-11-28 11:05:31 +00:00
parent 46ca0665fd
commit 6f54e82927
3 changed files with 3 additions and 3 deletions

View File

@ -80,7 +80,7 @@ _pthread_join(pthread_t pthread, void **thread_return)
THR_SCHED_UNLOCK(curthread, pthread);
/* Remove the reference and return an error: */
_thr_ref_delete(curthread, pthread);
ret = ESRCH;
ret = EINVAL;
} else {
/* Lock the target thread while checking its state. */
if (pthread->state == PS_DEAD) {

View File

@ -80,7 +80,7 @@ _pthread_join(pthread_t pthread, void **thread_return)
THR_SCHED_UNLOCK(curthread, pthread);
/* Remove the reference and return an error: */
_thr_ref_delete(curthread, pthread);
ret = ESRCH;
ret = EINVAL;
} else {
/* Lock the target thread while checking its state. */
if (pthread->state == PS_DEAD) {

View File

@ -88,7 +88,7 @@ join_common(pthread_t pthread, void **thread_return,
if ((ret = _thr_find_thread(curthread, pthread, 1)) != 0) {
ret = ESRCH;
} else if ((pthread->tlflags & TLFLAGS_DETACHED) != 0) {
ret = ESRCH;
ret = EINVAL;
} else if (pthread->joiner != NULL) {
/* Multiple joiners are not supported. */
ret = ENOTSUP;