[pypy-commit] stmgc c8-gil-like: fix
arigo
noreply at buildbot.pypy.org
Fri Jun 12 10:48:03 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: c8-gil-like
Changeset: r1811:4a03c8a56068
Date: 2015-06-12 10:48 +0200
http://bitbucket.org/pypy/stmgc/changeset/4a03c8a56068/
Log: fix
diff --git a/c8/demo/demo_random.c b/c8/demo/demo_random.c
--- a/c8/demo/demo_random.c
+++ b/c8/demo/demo_random.c
@@ -9,6 +9,7 @@
#include "stmgc.h"
#include "stm/fprintcolor.h"
+#include "stm/fprintcolor.c"
#define NUMTHREADS 2
#define STEPS_PER_THREAD 500
diff --git a/c8/stm/detach.c b/c8/stm/detach.c
--- a/c8/stm/detach.c
+++ b/c8/stm/detach.c
@@ -132,16 +132,17 @@
conditions.
*/
int mysegnum = STM_SEGMENT->segment_num;
+ bool sp_running = (STM_PSEGMENT->safe_point == SP_RUNNING);
int segnum = ((stm_thread_local_t *)old)->last_associated_segment_num;
dprintf(("commit_fetched_detached_transaction from seg %d\n", segnum));
assert(segnum > 0);
if (segnum != mysegnum) {
- s_mutex_lock();
- assert(STM_PSEGMENT->safe_point == SP_RUNNING);
- STM_PSEGMENT->safe_point = SP_COMMIT_OTHER_DETACHED;
- s_mutex_unlock();
-
+ if (sp_running) {
+ s_mutex_lock();
+ STM_PSEGMENT->safe_point = SP_COMMIT_OTHER_DETACHED;
+ s_mutex_unlock();
+ }
set_gs_register(get_segment_base(segnum));
}
commit_external_inevitable_transaction();
@@ -149,10 +150,12 @@
if (segnum != mysegnum) {
set_gs_register(get_segment_base(mysegnum));
- s_mutex_lock();
- assert(STM_PSEGMENT->safe_point == SP_COMMIT_OTHER_DETACHED);
- STM_PSEGMENT->safe_point = SP_RUNNING;
- s_mutex_unlock();
+ if (sp_running) {
+ s_mutex_lock();
+ assert(STM_PSEGMENT->safe_point == SP_COMMIT_OTHER_DETACHED);
+ STM_PSEGMENT->safe_point = SP_RUNNING;
+ s_mutex_unlock();
+ }
}
}
More information about the pypy-commit
mailing list