summaryrefslogtreecommitdiffstats
path: root/Doc/library/threading.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-02-26 09:59:26 (GMT)
committerGitHub <noreply@github.com>2024-02-26 09:59:26 (GMT)
commitdaa28d7552cf725aa80c7149b5b751079f4d6f09 (patch)
tree59f236782292d23e890c74636d5e6413ece8c811 /Doc/library/threading.rst
parent551e12f893b5e8c4ccfaf7edabf12f5fc5f82a81 (diff)
downloadcpython-daa28d7552cf725aa80c7149b5b751079f4d6f09.zip
cpython-daa28d7552cf725aa80c7149b5b751079f4d6f09.tar.gz
cpython-daa28d7552cf725aa80c7149b5b751079f4d6f09.tar.bz2
[3.12] Doc: Clarify the return type of Event.wait when timeout is used (GH-104168) (GH-115938)
(cherry picked from commit 37f5d06b1bf830048c09ed967bb2cda945d56541) Co-authored-by: Phil Elson <pelson.pub@gmail.com>
Diffstat (limited to 'Doc/library/threading.rst')
-rw-r--r--Doc/library/threading.rst17
1 files changed, 7 insertions, 10 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index 23d8cd1..25a738f 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -983,18 +983,15 @@ method. The :meth:`~Event.wait` method blocks until the flag is true.
.. method:: wait(timeout=None)
- Block until the internal flag is true. If the internal flag is true on
- entry, return immediately. Otherwise, block until another thread calls
- :meth:`.set` to set the flag to true, or until the optional timeout occurs.
+ Block as long as the internal flag is false and the timeout, if given,
+ has not expired. The return value represents the
+ reason that this blocking method returned; ``True`` if returning because
+ the internal flag is set to true, or ``False`` if a timeout is given and
+ the the internal flag did not become true within the given wait time.
When the timeout argument is present and not ``None``, it should be a
- floating point number specifying a timeout for the operation in seconds
- (or fractions thereof).
-
- This method returns ``True`` if and only if the internal flag has been set to
- true, either before the wait call or after the wait starts, so it will
- always return ``True`` except if a timeout is given and the operation
- times out.
+ floating point number specifying a timeout for the operation in seconds,
+ or fractions thereof.
.. versionchanged:: 3.1
Previously, the method always returned ``None``.