mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-18 19:06:25 +03:00
TSD: Add fork support to tsd_nominal_tsds.
In case of multithreaded fork, we want to leave the child in a reasonable state, in which tsd_nominal_tsds is either empty or contains only the forking thread.
This commit is contained in:
parent
013ab26c86
commit
41b7372ead
3 changed files with 28 additions and 0 deletions
|
|
@ -3470,6 +3470,7 @@ _malloc_prefork(void)
|
|||
}
|
||||
}
|
||||
prof_prefork1(tsd_tsdn(tsd));
|
||||
tsd_prefork(tsd);
|
||||
}
|
||||
|
||||
#ifndef JEMALLOC_MUTEX_INIT_CB
|
||||
|
|
@ -3492,6 +3493,8 @@ _malloc_postfork(void)
|
|||
|
||||
tsd = tsd_fetch();
|
||||
|
||||
tsd_postfork_parent(tsd);
|
||||
|
||||
witness_postfork_parent(tsd_witness_tsdp_get(tsd));
|
||||
/* Release all mutexes, now that fork() has completed. */
|
||||
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
||||
|
|
@ -3519,6 +3522,8 @@ jemalloc_postfork_child(void) {
|
|||
|
||||
tsd = tsd_fetch();
|
||||
|
||||
tsd_postfork_child(tsd);
|
||||
|
||||
witness_postfork_child(tsd_witness_tsdp_get(tsd));
|
||||
/* Release all mutexes, now that fork() has completed. */
|
||||
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue