[pypy-commit] pypy default: Trying half-heartedly to fix the timeout error that shows up every night
arigo
noreply at buildbot.pypy.org
Sun Sep 27 18:48:33 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r79869:598733b07629
Date: 2015-09-27 18:49 +0200
http://bitbucket.org/pypy/pypy/changeset/598733b07629/
Log: Trying half-heartedly to fix the timeout error that shows up every
night (with, of course, no clue about where it is)
diff --git a/pypy/module/thread/test/test_lock.py b/pypy/module/thread/test/test_lock.py
--- a/pypy/module/thread/test/test_lock.py
+++ b/pypy/module/thread/test/test_lock.py
@@ -123,23 +123,26 @@
self.sig_recvd = True
old_handler = signal.signal(signal.SIGUSR1, my_handler)
try:
+ ready = thread.allocate_lock()
+ ready.acquire()
def other_thread():
# Acquire the lock in a non-main thread, so this test works for
# RLocks.
lock.acquire()
- # Wait until the main thread is blocked in the lock acquire, and
- # then wake it up with this.
- time.sleep(0.5)
+ # Notify the main thread that we're ready
+ ready.release()
+ # Wait for 5 seconds here
+ for n in range(50):
+ time.sleep(0.1)
+ # Send the signal
os.kill(os.getpid(), signal.SIGUSR1)
# Let the main thread take the interrupt, handle it, and retry
# the lock acquisition. Then we'll let it run.
- time.sleep(0.5)
+ for n in range(50):
+ time.sleep(0.1)
lock.release()
thread.start_new_thread(other_thread, ())
- # Wait until we can't acquire it without blocking...
- while lock.acquire(blocking=False):
- lock.release()
- time.sleep(0.01)
+ ready.acquire()
result = lock.acquire() # Block while we receive a signal.
assert self.sig_recvd
assert result
More information about the pypy-commit
mailing list