[pypy-commit] stmgc c8-gil-like: Essential fix here: while waiting for the inevitable transaction to

arigo noreply at buildbot.pypy.org
Wed Jun 10 22:57:10 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: c8-gil-like
Changeset: r1800:9d96ac8b82e0
Date: 2015-06-10 22:57 +0200
http://bitbucket.org/pypy/stmgc/changeset/9d96ac8b82e0/

Log:	Essential fix here: while waiting for the inevitable transaction to
	commit, look if it is detached and commit it ourselves

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -496,11 +496,23 @@
 
 static void wait_for_other_inevitable(struct stm_commit_log_entry_s *old)
 {
+    int detached = fetch_detached_transaction();
+    if (detached >= 0) {
+        commit_fetched_detached_transaction(detached);
+        return;
+    }
+
     timing_event(STM_SEGMENT->running_thread, STM_WAIT_OTHER_INEVITABLE);
 
     while (old->next == INEV_RUNNING && !safe_point_requested()) {
         spin_loop();
         usleep(10);    /* XXXXXX */
+
+        detached = fetch_detached_transaction();
+        if (detached >= 0) {
+            commit_fetched_detached_transaction(detached);
+            break;
+        }
     }
     timing_event(STM_SEGMENT->running_thread, STM_WAIT_DONE);
 }
@@ -1278,7 +1290,8 @@
 
     assert(!_has_mutex());
     assert(STM_PSEGMENT->safe_point == SP_RUNNING);
-    assert(STM_PSEGMENT->running_pthread == pthread_self());
+    //assert(STM_PSEGMENT->running_pthread == pthread_self());
+    // ^^^ fails if detach.c commits a detached inevitable transaction
 
     dprintf(("> stm_commit_transaction()\n"));
     minor_collection(1);


More information about the pypy-commit mailing list