Skip to content

Commit 0f7f5a4

Browse files
[3.11] Doc: Clarify the return type of Event.wait when timeout is used (GH-104168) (GH-115939)
(cherry picked from commit 37f5d06) Co-authored-by: Phil Elson <[email protected]>
1 parent 392bc9a commit 0f7f5a4

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
@@ -965,18 +965,15 @@ method. The :meth:`~Event.wait` method blocks until the flag is true.
965965

966966
.. method:: wait(timeout=None)
967967

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

972974
When the timeout argument is present and not ``None``, it should be a
973-
floating point number specifying a timeout for the operation in seconds
974-
(or fractions thereof).
975-
976-
This method returns ``True`` if and only if the internal flag has been set to
977-
true, either before the wait call or after the wait starts, so it will
978-
always return ``True`` except if a timeout is given and the operation
979-
times out.
975+
floating point number specifying a timeout for the operation in seconds,
976+
or fractions thereof.
980977

981978
.. versionchanged:: 3.1
982979
Previously, the method always returned ``None``.

0 commit comments

Comments
 (0)