[pypy-commit] pypy stm-gc: Fix the 'transaction' module too.

arigo noreply at buildbot.pypy.org
Sun Feb 19 20:11:08 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52650:18482c0cbdd6
Date: 2012-02-19 19:12 +0100
http://bitbucket.org/pypy/pypy/changeset/18482c0cbdd6/

Log:	Fix the 'transaction' module too.

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
@@ -261,7 +261,7 @@
 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, ())
+        threadintf.start_new_thread(_run_thread)
     #
     state.lock_unfinished()  # wait for all threads to finish
     # --- done, we can use the GC again ---
diff --git a/pypy/module/transaction/threadintf.py b/pypy/module/transaction/threadintf.py
--- a/pypy/module/transaction/threadintf.py
+++ b/pypy/module/transaction/threadintf.py
@@ -1,6 +1,8 @@
 import thread
 from pypy.module.thread import ll_thread
 from pypy.rlib.objectmodel import we_are_translated
+from pypy.rpython.annlowlevel import llhelper
+from pypy.rlib.debug import fatalerror
 
 
 null_ll_lock = ll_thread.null_ll_lock
@@ -23,9 +25,11 @@
     else:
         lock.release()
 
-def start_new_thread(callback, args):
-    assert args == ()
+def start_new_thread(callback):
     if we_are_translated():
-        ll_thread.start_new_thread(callback, args)
+        llcallback = llhelper(ll_thread.CALLBACK, callback)
+        ident = ll_thread.c_thread_start_NOGIL(llcallback)
+        if ident == -1:
+            fatalerror("cannot start thread")
     else:
-        thread.start_new_thread(callback, args)
+        thread.start_new_thread(callback, ())


More information about the pypy-commit mailing list