mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-21 16:32:25 +01:00
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:
parent
46ca0665fd
commit
6f54e82927
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164715
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user