Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r74379:38c9afbd253c
Date: 2014-11-07 20:04 +0100
http://bitbucket.org/pypy/pypy/changeset/38c9afbd253c/

Log:    import stmgc/b27bcdd6bc87 [hashtable]

diff --git a/rpython/translator/stm/src_stm/revision 
b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-ece6317ba186
+b27bcdd6bc87
diff --git a/rpython/translator/stm/src_stm/stm/forksupport.c 
b/rpython/translator/stm/src_stm/stm/forksupport.c
--- a/rpython/translator/stm/src_stm/stm/forksupport.c
+++ b/rpython/translator/stm/src_stm/stm/forksupport.c
@@ -202,9 +202,6 @@
        just release these locks early */
     s_mutex_unlock();
 
-    /* Open a new profiling file, if any */
-    forksupport_open_new_profiling_file();
-
     /* Move the copy of the mmap over the old one, overwriting it
        and thus freeing the old mapping in this process
     */
diff --git a/rpython/translator/stm/src_stm/stm/prof.c 
b/rpython/translator/stm/src_stm/stm/prof.c
--- a/rpython/translator/stm/src_stm/stm/prof.c
+++ b/rpython/translator/stm/src_stm/stm/prof.c
@@ -75,7 +75,13 @@
     return false;
 }
 
-static void forksupport_open_new_profiling_file(void)
+static void prof_forksupport_prepare(void)
+{
+    if (profiling_file != NULL)
+        fflush(profiling_file);
+}
+
+static void prof_forksupport_child(void)
 {
     if (close_timing_log() && profiling_basefn != NULL) {
         char filename[1024];
@@ -99,6 +105,15 @@
         expand_marker = default_expand_marker;
     profiling_expand_marker = expand_marker;
 
+    static bool fork_support_ready = false;
+    if (!fork_support_ready) {
+        int res = pthread_atfork(prof_forksupport_prepare,
+                                 NULL, prof_forksupport_child);
+        if (res != 0)
+            stm_fatalerror("pthread_atfork() failed: %m");
+        fork_support_ready = true;
+    }
+
     if (!open_timing_log(profiling_file_name))
         return -1;
 
diff --git a/rpython/translator/stm/src_stm/stmgc.c 
b/rpython/translator/stm/src_stm/stmgc.c
--- a/rpython/translator/stm/src_stm/stmgc.c
+++ b/rpython/translator/stm/src_stm/stmgc.c
@@ -16,7 +16,6 @@
 #include "stm/fprintcolor.h"
 #include "stm/weakref.h"
 #include "stm/marker.h"
-#include "stm/prof.h"
 #include "stm/finalizer.h"
 #include "stm/hashtable.h"
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to