Author: Armin Rigo <[email protected]>
Branch: c7-more-segments
Changeset: r1046:d9c43a29891e
Date: 2014-03-16 12:45 +0100
http://bitbucket.org/pypy/stmgc/changeset/d9c43a29891e/
Log: Proper fix. Now demo_random passes at least once :-)
diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -555,8 +555,11 @@
/* invoke the callbacks */
invoke_and_clear_callbacks_on_abort();
- if (STM_SEGMENT->nursery_end == NSE_SIGABORT)
- STM_SEGMENT->nursery_end = NURSERY_END; /* done aborting */
+ if (STM_SEGMENT->nursery_end == NSE_SIGABORT) {
+ /* done aborting */
+ STM_SEGMENT->nursery_end = pause_signalled ? NSE_SIGPAUSE
+ : NURSERY_END;
+ }
_finish_transaction();
/* cannot access STM_SEGMENT or STM_PSEGMENT from here ! */
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -267,6 +267,8 @@
if (get_segment(i)->nursery_end == NURSERY_END)
get_segment(i)->nursery_end = NSE_SIGPAUSE;
}
+ assert(!pause_signalled);
+ pause_signalled = true;
}
static inline long count_other_threads_sp_running(void)
@@ -288,17 +290,14 @@
static void remove_requests_for_safe_point(void)
{
+ assert(pause_signalled);
+ pause_signalled = false;
assert(_safe_points_requested == true);
assert((_safe_points_requested = false, 1));
long i;
for (i = 1; i <= NB_SEGMENTS; i++) {
- /* note: the only possible way to concurrently change the value
- of 'nursery_end' is with an abort done while we wait for
- C_AT_SAFE_POINT. It's fine because the next transaction
- should not start. */
- assert(get_segment(i)->nursery_end != NURSERY_END ||
- get_priv_segment(i)->transaction_state == TS_NONE);
+ assert(get_segment(i)->nursery_end != NURSERY_END);
if (get_segment(i)->nursery_end == NSE_SIGPAUSE)
get_segment(i)->nursery_end = NURSERY_END;
}
diff --git a/c7/stm/sync.h b/c7/stm/sync.h
--- a/c7/stm/sync.h
+++ b/c7/stm/sync.h
@@ -30,3 +30,5 @@
static void wait_for_end_of_inevitable_transaction(bool can_abort);
static void synchronize_all_threads(void);
+
+static bool pause_signalled;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit