mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Use support.sleeping_retry() and support.busy_retry() (#93848)
* Replace time.sleep(0.010) with sleeping_retry() to use an exponential sleep. * support.wait_process(): reuse sleeping_retry(). * _test_eintr: remove unused variables.
This commit is contained in:
parent
bddbd80cff
commit
0ba80273f2
7 changed files with 51 additions and 58 deletions
|
@ -28,16 +28,15 @@ class InterProcessSignalTests(unittest.TestCase):
|
|||
# (if set)
|
||||
child.wait()
|
||||
|
||||
timeout = support.SHORT_TIMEOUT
|
||||
deadline = time.monotonic() + timeout
|
||||
|
||||
while time.monotonic() < deadline:
|
||||
start_time = time.monotonic()
|
||||
for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):
|
||||
if self.got_signals[signame]:
|
||||
return
|
||||
signal.pause()
|
||||
|
||||
self.fail('signal %s not received after %s seconds'
|
||||
% (signame, timeout))
|
||||
else:
|
||||
dt = time.monotonic() - start_time
|
||||
self.fail('signal %s not received after %.1f seconds'
|
||||
% (signame, dt))
|
||||
|
||||
def subprocess_send_signal(self, pid, signame):
|
||||
code = 'import os, signal; os.kill(%s, signal.%s)' % (pid, signame)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue