1. Pypy
  2. Untitled project
  3. pypy

Commits

Armin Rigo  committed 1a3d866

hg backout 009b40655c5f: remove the hack based on signals.

  • Participants
  • Parent commits b2f107c
  • Branches stm-thread-2

Comments (0)

Files changed (1)

File lib_pypy/transaction.py

View file
 import sys, thread, collections
 
 try:
-    import signal, posix
-    from signal import SIGUSR2 as SIG_DONE
-except ImportError:
-    signal = None
-
-try:
     from thread import atomic
 except ImportError:
     # Not a STM-enabled PyPy.  We can still provide a version of 'atomic'
         self.in_transaction = True
 
     def run(self):
-        self.use_signals = hasattr(signal, 'pause')
-        if self.use_signals:
-            try:
-                self.signalled = 0
-                def signal_handler(*args):
-                    self.signalled = 1
-                prev_handler = signal.signal(SIG_DONE, signal_handler)
-            except ValueError:
-                self.use_signals = False
         # start the N threads
         for i in range(self.num_threads):
             thread.start_new_thread(self._run_thread, ())
         # now wait.  When we manage to acquire the following lock, then
         # we are finished.
-        if self.use_signals:
-            try:
-                while not self.signalled:
-                    signal.pause()
-            finally:
-                self.use_signals = False
-            signal.signal(SIG_DONE, prev_handler)
-        else:
-            self.lock_if_released_then_finished.acquire()
+        self.lock_if_released_then_finished.acquire()
 
     def teardown(self):
         self.in_transaction = False
                 self.lock_mutex.release()
                 if last_one_to_leave:
                     self.lock_if_released_then_finished.release()
-                    with atomic:
-                        if self.use_signals:
-                            posix.kill(posix.getpid(), SIG_DONE)
                 raise _Done
 
     @staticmethod