Commits

Armin Rigo committed 31de936

A better fix.

Comments (0)

Files changed (1)

lib_pypy/transaction.py

         # 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
             #
             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