Skip to content

Commit 7bad39f

Browse files
author
Tim Peters
committed
Fiddled Thread.join() to be a little simpler. Kinda ;-)
1 parent e5bb0bf commit 7bad39f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/threading.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,10 +1059,10 @@ def join(self, timeout=None):
10591059

10601060
if timeout is None:
10611061
self._wait_for_tstate_lock()
1062-
elif timeout >= 0:
1063-
self._wait_for_tstate_lock(timeout=timeout)
1064-
# else it's a negative timeout - precise behavior isn't documented
1065-
# then, but historically .join() returned in this case
1062+
else:
1063+
# the behavior of a negative timeout isn't documented, but
1064+
# historically .join() has acted as if timeout=0 then
1065+
self._wait_for_tstate_lock(timeout=max(timeout, 0))
10661066

10671067
def _wait_for_tstate_lock(self, block=True, timeout=-1):
10681068
# Issue #18808: wait for the thread state to be gone.

0 commit comments

Comments
 (0)