projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fca7428
)
clear need_locks in child after fork
author
Rich Felker
<dalias@aerifal.cx>
Sun, 21 Jun 2020 06:15:50 +0000
(
02:15
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 21 Jun 2020 06:15:50 +0000
(
02:15
-0400)
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.
src/process/fork.c
patch
|
blob
|
history
diff --git
a/src/process/fork.c
b/src/process/fork.c
index
fb42478
..
7e984ff
100644
(file)
--- a/
src/process/fork.c
+++ b/
src/process/fork.c
@@
-30,6
+30,7
@@
pid_t fork(void)
self->next = self->prev = self;
__thread_list_lock = 0;
libc.threads_minus_1 = 0;
+ if (libc.need_locks) libc.need_locks = -1;
}
__restore_sigs(&set);
__fork_handler(!ret);