mirror of
git://git.musl-libc.org/musl
synced 2025-01-30 02:22:43 +00:00
fix unsynchronized decrement of thread count on pthread_create error
commit 8f11e6127f
wrongly documented
that all changes to libc.threads_minus_1 were guarded by the thread
list lock, but the decrement for failed SYS_clone took place after the
thread list lock was released.
This commit is contained in:
parent
a882841baf
commit
dd0a23dd9e
@ -356,13 +356,14 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
|
||||
new->prev = self;
|
||||
new->next->prev = new;
|
||||
new->prev->next = new;
|
||||
} else {
|
||||
libc.threads_minus_1--;
|
||||
}
|
||||
__tl_unlock();
|
||||
__restore_sigs(&set);
|
||||
__release_ptc();
|
||||
|
||||
if (ret < 0) {
|
||||
libc.threads_minus_1--;
|
||||
if (map) __munmap(map, size);
|
||||
return EAGAIN;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user