mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
o If a thread is marked as detached AND on the dead threads list
the correct return value is ESRCH. o Don't check the attribute for NULL. It's the caller's responsibility. o Make the bitwise comparison explicit.
This commit is contained in:
parent
2c08d6bea1
commit
8c223652fb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127568
@ -41,14 +41,14 @@ __weak_reference(_pthread_detach, pthread_detach);
|
||||
int
|
||||
_pthread_detach(pthread_t pthread)
|
||||
{
|
||||
if (pthread == NULL || pthread->magic != PTHREAD_MAGIC)
|
||||
if (pthread->magic != PTHREAD_MAGIC)
|
||||
return (EINVAL);
|
||||
|
||||
UMTX_LOCK(&pthread->lock);
|
||||
|
||||
if (pthread->attr.flags & PTHREAD_DETACHED) {
|
||||
if ((pthread->attr.flags & PTHREAD_DETACHED) != 0) {
|
||||
UMTX_UNLOCK(&pthread->lock);
|
||||
return (EINVAL);
|
||||
return ((pthread->state == PS_DEAD) ? ESRCH : EINVAL);
|
||||
}
|
||||
|
||||
pthread->attr.flags |= PTHREAD_DETACHED;
|
||||
|
Loading…
Reference in New Issue
Block a user