Skip to content

Commit 6691a23

Browse files
committed
Join only unblocks with zero unfinished tasks
1 parent 9a6b60a commit 6691a23

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Doc/library/asyncio-queue.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ Queue
120120
raise :exc:`QueueShutDown`.
121121

122122
If *immediate* is true, the queue is terminated immediately.
123-
The queue is drained to be completely empty. All callers of
124-
:meth:`~Queue.join` are unblocked regardless of the number
125-
of unfinished tasks. Blocked callers of :meth:`~Queue.get`
123+
The queue is drained to be completely empty and the count
124+
of unfinished tasks is reduced by the number of tasks drained.
125+
If unfinished tasks is zero, callers of :meth:`~Queue.join`
126+
are unblocked. Also, blocked callers of :meth:`~Queue.get`
126127
are unblocked and will raise :exc:`QueueShutDown` because the
127128
queue is empty.
128129

Doc/library/queue.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ until empty or terminated immediately with a hard shutdown.
256256
raise :exc:`ShutDown`.
257257

258258
If *immediate* is true, the queue is terminated immediately.
259-
The queue is drained to be completely empty. All callers of
260-
:meth:`~Queue.join` are unblocked regardless of the number
261-
of unfinished tasks. Blocked callers of :meth:`~Queue.get`
259+
The queue is drained to be completely empty and the count
260+
of unfinished tasks is reduced by the number of tasks drained.
261+
If unfinished tasks is zero, callers of :meth:`~Queue.join`
262+
are unblocked. Also, blocked callers of :meth:`~Queue.get`
262263
are unblocked and will raise :exc:`ShutDown` because the
263264
queue is empty.
264265

0 commit comments

Comments
 (0)