8000 gh-117531: Unblock getters after non-immediate queue shutdown by EpicWink · Pull Request #117532 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117531: Unblock getters after non-immediate queue shutdown #117532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 10, 2024
Prev Previous commit
Next Next commit
Mention gets are always unblocked
  • Loading branch information
EpicWink committed Apr 8, 2024
commit 61d2010de747c1c051b23c7f72722bbb69a7fbd3
6 changes: 4 additions & 2 deletions Doc/library/queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ them down.
queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise
immediately instead.

All blocked callers of :meth:`~Queue.put` will be unblocked. If *immediate*
is true, also unblock callers of :meth:`~Queue.get` and :meth:`~Queue.join`.
All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be
unblocked. If *immediate* is true, a task will be marked as done for each
remaining item in the queue, which may unblock callers of
:meth:`~Queue.join`.

.. versionadded:: 3.13

Expand Down
5 changes: 3 additions & 2 deletions Lib/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ def shutdown(self, immediate=False):
By default, gets will only raise once the queue is empty. Set
'immediate' to True to make gets raise immediately instead.

All blocked callers of put() will be unblocked, and also get()
and join() if 'immediate'.
All blocked callers of put() and get() will be unblocked. If
'immediate', a task is marked as done for each item remaining in
the queue, which may unblock callers of join().
'''
with self.mutex:
self.is_shutdown = True
Expand Down
2923
0