@@ -310,6 +310,9 @@ Queue
310310 be interrupted between calling :meth: `qsize ` and doing an operation on the
311311 Queue.
312312
313+ .. versionchanged :: 3.4.3
314+ New :meth: `join ` and :meth: `task_done ` methods.
315+
313316 .. method :: empty()
314317
315318 Return ``True `` if the queue is empty, ``False `` otherwise.
@@ -341,6 +344,20 @@ Queue
341344 Return an item if one is immediately available, else raise
342345 :exc: `QueueEmpty `.
343346
347+ .. coroutinemethod :: join()
348+
349+ Block until all items in the queue have been gotten and processed.
350+
351+ The count of unfinished tasks goes up whenever an item is added to the
352+ queue. The count goes down whenever a consumer thread calls
353+ :meth: `task_done ` to indicate that the item was retrieved and all work on
354+ it is complete. When the count of unfinished tasks drops to zero,
355+ :meth: `join ` unblocks.
356+
357+ This method is a :ref: `coroutine <coroutine >`.
358+
359+ .. versionadded :: 3.4.3
360+
344361 .. coroutinemethod :: put(item)
345362
346363 Put an item into the queue. If the queue is full, wait until a free slot
@@ -362,6 +379,23 @@ Queue
362379
363380 Number of items in the queue.
364381
382+ .. method :: task_done()
383+
384+ Indicate that a formerly enqueued task is complete.
385+
386+ Used by queue consumers. For each :meth: `~Queue.get ` used to fetch a task, a
387+ subsequent call to :meth: `task_done ` tells the queue that the processing
388+ on the task is complete.
389+
390+ If a :meth: `join ` is currently blocking, it will resume when all items
391+ have been processed (meaning that a :meth: `task_done ` call was received
392+ for every item that had been :meth: `~Queue.put ` into the queue).
393+
394+ Raises :exc: `ValueError ` if called more times than there were items
395+ placed in the queue.
396+
397+ .. versionadded :: 3.4.3
398+
365399 .. attribute :: maxsize
366400
367401 Number of items allowed in the queue.
@@ -392,35 +426,9 @@ JoinableQueue
392426
393427.. class :: JoinableQueue
394428
395- A subclass of :class: `Queue ` with :meth: `task_done ` and :meth: `join `
396- methods.
397-
398- .. coroutinemethod :: join()
399-
400- Block until all items in the queue have been gotten and processed.
401-
402- The count of unfinished tasks goes up whenever an item is added to the
403- queue. The count goes down whenever a consumer thread calls
404- :meth: `task_done ` to indicate that the item was retrieved and all work on
405- it is complete. When the count of unfinished tasks drops to zero,
406- :meth: `join ` unblocks.
407-
408- This method is a :ref: `coroutine <coroutine >`.
409-
410- .. method :: task_done()
411-
412- Indicate that a formerly enqueued task is complete.
413-
414- Used by queue consumers. For each :meth: `~Queue.get ` used to fetch a task, a
415- subsequent call to :meth: `task_done ` tells the queue that the processing
416- on the task is complete.
417-
418- If a :meth: `join ` is currently blocking, it will resume when all items
419- have been processed (meaning that a :meth: `task_done ` call was received
420- for every item that had been :meth: `~Queue.put ` into the queue).
429+ Deprecated alias for :class: `Queue `.
421430
422- Raises :exc: `ValueError ` if called more times than there were items
423- placed in the queue.
431+ .. deprecated :: 3.4.3
424432
425433
426434Exceptions
0 commit comments