Commit 5cd72ca6 authored by Guido van Rossum's avatar Guido van Rossum

Subtle change to run() loop: when a deadlock is detected, set

_deadline to None, to prevent reporting the same timeout more than
once.  Added a helpful comment too. :-)
parent 00ea7fe4
...@@ -824,9 +824,12 @@ class TimeoutThread(threading.Thread): ...@@ -824,9 +824,12 @@ class TimeoutThread(threading.Thread):
while 1: while 1:
self._cond.acquire() self._cond.acquire()
try: try:
while self._client is None: while self._deadline is None:
self._cond.wait() self._cond.wait()
howlong = self._deadline - time.time() howlong = self._deadline - time.time()
if howlong <= 0:
# Prevent reporting timeout more than once
self._deadline = None
client = self._client # For the howlong <= 0 branch below client = self._client # For the howlong <= 0 branch below
finally: finally:
self._cond.release() self._cond.release()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment