Author: Remi Meier <[email protected]>
Branch: c8-overflow-objs
Changeset: r1677:4133909b27dd
Date: 2015-02-27 14:09 +0100
http://bitbucket.org/pypy/stmgc/changeset/4133909b27dd/
Log: maybe fix a fork issue
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -891,24 +891,10 @@
bool was_inev = STM_PSEGMENT->transaction_state == TS_INEVITABLE;
_validate_and_add_to_commit_log();
+ stm_rewind_jmp_forget(STM_SEGMENT->running_thread);
/* XXX do we still need a s_mutex_lock() section here? */
s_mutex_lock();
-
- enter_safe_point_if_requested();
- assert(STM_SEGMENT->nursery_end == NURSERY_END);
-
- stm_rewind_jmp_forget(STM_SEGMENT->running_thread);
-
- /* if a major collection is required, do it here */
- if (is_major_collection_requested()) {
- synchronize_all_threads(STOP_OTHERS_UNTIL_MUTEX_UNLOCK);
-
- if (is_major_collection_requested()) { /* if *still* true */
- major_collection_now_at_safe_point();
- }
- }
-
commit_finalizers();
/* update 'overflow_number' if needed */
@@ -922,6 +908,19 @@
invoke_and_clear_user_callbacks(0); /* for commit */
+ /* >>>>> there may be a FORK() happening in the safepoint below <<<<<*/
+ enter_safe_point_if_requested();
+ assert(STM_SEGMENT->nursery_end == NURSERY_END);
+
+ /* if a major collection is required, do it here */
+ if (is_major_collection_requested()) {
+ synchronize_all_threads(STOP_OTHERS_UNTIL_MUTEX_UNLOCK);
+
+ if (is_major_collection_requested()) { /* if *still* true */
+ major_collection_now_at_safe_point();
+ }
+ }
+
if (globally_unique_transaction && was_inev) {
committed_globally_unique_transaction();
}
diff --git a/c8/stm/forksupport.c b/c8/stm/forksupport.c
--- a/c8/stm/forksupport.c
+++ b/c8/stm/forksupport.c
@@ -89,6 +89,18 @@
assert(STM_SEGMENT->segment_num == i);
s_mutex_lock();
+ if (pr->transaction_state == TS_NONE) {
+ /* just committed, TS_NONE but still has running_thread */
+
+ /* do _finish_transaction() */
+ STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
+ list_clear(STM_PSEGMENT->objects_pointing_to_nursery);
+ list_clear(STM_PSEGMENT->large_overflow_objects);
+
+ s_mutex_unlock();
+ return;
+ }
+
#ifndef NDEBUG
pr->running_pthread = pthread_self();
#endif
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit