[pypy-commit] stmgc use-gcc: add stm_leave_transactional_zone_final for use before freeing thread resources
Raemi
noreply at buildbot.pypy.org
Fri Jul 24 11:11:21 CEST 2015
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: use-gcc
Changeset: r1896:c0e7e64a894d
Date: 2015-07-24 11:13 +0200
http://bitbucket.org/pypy/stmgc/changeset/c0e7e64a894d/
Log: add stm_leave_transactional_zone_final for use before freeing thread
resources
diff --git a/c8/stm/sync.c b/c8/stm/sync.c
--- a/c8/stm/sync.c
+++ b/c8/stm/sync.c
@@ -14,7 +14,8 @@
pthread_mutex_t global_mutex;
pthread_cond_t cond[_C_TOTAL];
/* some additional pieces of global state follow */
- uint8_t in_use1[NB_SEGMENTS]; /* 1 if running a pthread, idx=0 unused */
+ uint8_t in_use1[NB_SEGMENTS]; /* 1 if running a pthread, idx=0 unused,
+ 2 if soon_finished_or_inevitable_thread_segment */
};
char reserved[192];
} sync_ctl __attribute__((aligned(64)));
diff --git a/c8/stmgc.h b/c8/stmgc.h
--- a/c8/stmgc.h
+++ b/c8/stmgc.h
@@ -437,6 +437,10 @@
stm_enter_transactional_zone() and stm_leave_transactional_zone()
preserve the value of errno.
+
+ stm_leave_transactional_zone_final() commits the transaction
+ unconditionally and allows the caller to teardown the whole
+ thread (unregister thread local, etc.).
*/
#ifdef STM_DEBUGPRINT
#include <stdio.h>
@@ -468,6 +472,11 @@
_stm_leave_noninevitable_transactional_zone();
}
}
+static inline void stm_leave_transactional_zone_final(stm_thread_local_t *tl) {
+ assert(STM_SEGMENT->running_thread == tl);
+ _stm_commit_transaction();
+}
+
/* stm_force_transaction_break() is in theory equivalent to
stm_leave_transactional_zone() immediately followed by
More information about the pypy-commit
mailing list