summaryrefslogtreecommitdiffstats
path: root/src/witness.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-04-26 17:47:22 (GMT)
committerJason Evans <jasone@canonware.com>2016-04-26 17:47:22 (GMT)
commit108c4a11e96d57fd71751efa23ab986a236a0c7d (patch)
tree4b114e09628d921d3da62095ec4a5c1d5d5ec3e6 /src/witness.c
parent174c0c3a9c63b3a0bfa32381148b537e9b9af96d (diff)
downloadjemalloc-108c4a11e96d57fd71751efa23ab986a236a0c7d.zip
jemalloc-108c4a11e96d57fd71751efa23ab986a236a0c7d.tar.gz
jemalloc-108c4a11e96d57fd71751efa23ab986a236a0c7d.tar.bz2
Fix witness/fork() interactions.
Fix witness to clear its list of owned mutexes in the child if platform-specific malloc_mutex code re-initializes mutexes rather than unlocking them.
Diffstat (limited to 'src/witness.c')
-rw-r--r--src/witness.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/witness.c b/src/witness.c
index b5384a2..31c36a2 100644
--- a/src/witness.c
+++ b/src/witness.c
@@ -222,8 +222,20 @@ witness_prefork(tsd_t *tsd)
}
void
-witness_postfork(tsd_t *tsd)
+witness_postfork_parent(tsd_t *tsd)
{
tsd_witness_fork_set(tsd, false);
}
+
+void
+witness_postfork_child(tsd_t *tsd)
+{
+#ifndef JEMALLOC_MUTEX_INIT_CB
+ witness_list_t *witnesses;
+
+ witnesses = tsd_witnessesp_get(tsd);
+ ql_new(witnesses);
+#endif
+ tsd_witness_fork_set(tsd, false);
+}