mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
clear need_locks in child after fork
the child is single-threaded, but may still need to synchronize with last changes made to memory by another thread in the parent, so set need_locks to -1 whereby the next lock-taker will drop to 0 and prevent further barriers/locking.
This commit is contained in:
parent
fca7428c09
commit
8ed2bd8bfc
1 changed files with 1 additions and 0 deletions
|
@ -30,6 +30,7 @@ pid_t fork(void)
|
||||||
self->next = self->prev = self;
|
self->next = self->prev = self;
|
||||||
__thread_list_lock = 0;
|
__thread_list_lock = 0;
|
||||||
libc.threads_minus_1 = 0;
|
libc.threads_minus_1 = 0;
|
||||||
|
if (libc.need_locks) libc.need_locks = -1;
|
||||||
}
|
}
|
||||||
__restore_sigs(&set);
|
__restore_sigs(&set);
|
||||||
__fork_handler(!ret);
|
__fork_handler(!ret);
|
||||||
|
|
Loading…
Add table
Reference in a new issue