[pypy-commit] pypy stm-gc: Ensure that no collect at all occur in the main thread when
arigo
noreply at buildbot.pypy.org
Sun Feb 19 20:11:06 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52648:d13a7a65bcc8
Date: 2012-02-19 18:55 +0100
http://bitbucket.org/pypy/pypy/changeset/d13a7a65bcc8/
Log: Ensure that no collect at all occur in the main thread when the
other threads may be running.
diff --git a/pypy/module/transaction/interp_transaction.py b/pypy/module/transaction/interp_transaction.py
--- a/pypy/module/transaction/interp_transaction.py
+++ b/pypy/module/transaction/interp_transaction.py
@@ -2,7 +2,7 @@
from pypy.interpreter.gateway import unwrap_spec
from pypy.module.transaction import threadintf
from pypy.module.transaction.fifo import Fifo
-from pypy.rlib import rstm
+from pypy.rlib import rstm, rgc
from pypy.rlib.debug import ll_assert
@@ -257,6 +257,16 @@
state.unlock()
+ at rgc.no_collect
+def _run():
+ # --- start the threads --- don't use the GC here any more! ---
+ for i in range(state.num_threads):
+ threadintf.start_new_thread(_run_thread, ())
+ #
+ state.lock_unfinished() # wait for all threads to finish
+ # --- done, we can use the GC again ---
+
+
def run(space):
if state.running:
raise OperationError(
@@ -279,12 +289,8 @@
state.running = True
state.init_exceptions()
#
- # --- start the threads --- don't use the GC here any more! ---
- for i in range(state.num_threads):
- threadintf.start_new_thread(_run_thread, ())
- #
- state.lock_unfinished() # wait for all threads to finish
- # --- done, we can use the GC again ---
+ # start the threads and wait for all of them to finish
+ _run()
#
assert state.num_waiting_threads == 0
assert state.pending.is_empty()
More information about the pypy-commit
mailing list