Author: Armin Rigo <[email protected]>
Branch: stm-thread
Changeset: r55022:31de93640630
Date: 2012-05-11 00:37 +0200
http://bitbucket.org/pypy/pypy/changeset/31de93640630/

Log:    A better fix.

diff --git a/lib_pypy/transaction.py b/lib_pypy/transaction.py
--- a/lib_pypy/transaction.py
+++ b/lib_pypy/transaction.py
@@ -111,7 +111,6 @@
         # now wait.  When we manage to acquire the following lock, then
         # we are finished.
         self.lock_if_released_then_finished.acquire()
-        self.lock_mutex.acquire()   # wait until the threads are really done
 
     def teardown(self):
         self.in_transaction = False
@@ -185,9 +184,10 @@
             #
             self.num_waiting_threads -= 1
             if self.finished:
-                if self.num_waiting_threads == 0:    # last one to leave?
+                last_one_to_leave = self.num_waiting_threads == 0
+                self.lock_mutex.release()
+                if last_one_to_leave:
                     self.lock_if_released_then_finished.release()
-                self.lock_mutex.release()
                 raise _Done
 
     @staticmethod
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to