Skip to content

Commit 37f5d06

Browse files
authored
Doc: Clarify the return type of Event.wait when timeout is used (GH-104168)
1 parent 915d7dd commit 37f5d06

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Doc/library/threading.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -987,18 +987,15 @@ method. The :meth:`~Event.wait` method blocks until the flag is true.
987987

988988
.. method:: wait(timeout=None)
989989

990-
Block until the internal flag is true. If the internal flag is true on
991-
entry, return immediately. Otherwise, block until another thread calls
992-
:meth:`.set` to set the flag to true, or until the optional timeout occurs.
990+
Block as long as the internal flag is false and the timeout, if given,
991+
has not expired. The return value represents the
992+
reason that this blocking method returned; ``True`` if returning because
993+
the internal flag is set to true, or ``False`` if a timeout is given and
994+
the the internal flag did not become true within the given wait time.
993995

994996
When the timeout argument is present and not ``None``, it should be a
995-
floating point number specifying a timeout for the operation in seconds
996-
(or fractions thereof).
997-
998-
This method returns ``True`` if and only if the internal flag has been set to
999-
true, either before the wait call or after the wait starts, so it will
1000-
always return ``True`` except if a timeout is given and the operation
1001-
times out.
997+
floating point number specifying a timeout for the operation in seconds,
998+
or fractions thereof.
1002999

10031000
.. versionchanged:: 3.1
10041001
Previously, the method always returned ``None``.

0 commit comments

Comments
 (0)