Author: Armin Rigo <[email protected]>
Branch: stm-thread-2
Changeset: r60785:1a3d8664bdde
Date: 2013-01-31 18:16 +0100
http://bitbucket.org/pypy/pypy/changeset/1a3d8664bdde/
Log: hg backout 009b40655c5f: remove the hack based on signals.
diff --git a/lib_pypy/transaction.py b/lib_pypy/transaction.py
--- a/lib_pypy/transaction.py
+++ b/lib_pypy/transaction.py
@@ -15,12 +15,6 @@
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'
@@ -115,29 +109,12 @@
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
@@ -216,9 +193,6 @@
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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit