Skip to content
Draft
Prev Previous commit
Next Next commit
Update docs, add to what's-new
  • Loading branch information
EpicWink committed Mar 22, 2024
commit ee8d4df7ebd9e38fbe9ae01c8bc8881bbfa5c12d
19 changes: 9 additions & 10 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ For an example of the usage of queues for interprocess communication see
free slot was available within that time. Otherwise (*block* is
``False``), put an item on the queue if a free slot is immediately
available, else raise the :exc:`queue.Full` exception (*timeout* is
ignored in that case). Raises :exc:`ShutDown` if the queue has been shut
down.
ignored in that case). Raises the :exc:`queue.ShutDown` if the queue has
been shut down.

.. versionchanged:: 3.8
If the queue is closed, :exc:`ValueError` is raised instead of
Expand All @@ -871,8 +871,8 @@ For an example of the usage of queues for interprocess communication see
exception if no item was available within that time. Otherwise (block is
``False``), return an item if one is immediately available, else raise the
:exc:`queue.Empty` exception (*timeout* is ignored in that case). Raises
:exc:`queue.ShutDown` if the queue has been shut down and is empty, or if
the queue has been shut down immediately.
the :exc:`queue.ShutDown` exception if the queue has been shut down and
is empty, or if the queue has been shut down immediately.

.. versionchanged:: 3.8
If the queue is closed, :exc:`ValueError` is raised instead of
Expand All @@ -884,14 +884,14 @@ For an example of the usage of queues for interprocess communication see

.. method:: shutdown(immediate=False)

Shut-down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put`
Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put`
raise :exc:`queue.ShutDown`.

By default, :meth:`~Queue.get` on a shut down queue will only raise once
the 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
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`.

Expand Down Expand Up @@ -983,11 +983,12 @@ For an example of the usage of queues for interprocess communication see
items have been processed (meaning that a :meth:`task_done` call was
received for every item that had been :meth:`~Queue.put` into the queue).

``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining
item in the queue.

Raises a :exc:`ValueError` if called more times than there were items
placed in the queue.

Raises :exc:`queue.ShutDown` if the queue has been shut down immediately.


.. method:: join()

Expand All @@ -999,8 +1000,6 @@ For an example of the usage of queues for interprocess communication see
it is complete. When the count of unfinished tasks drops to zero,
:meth:`~queue.Queue.join` unblocks.

Raises :exc:`queue.ShutDown` if the queue has been shut down immediately.


Miscellaneous
^^^^^^^^^^^^^
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ mmap
the file descriptor specified by *fileno* will not be duplicated.
(Contributed by Zackery Spytz and Petr Viktorin in :gh:`78502`.)

multiprocessing
---------------

* Add :meth:`multiprocessing.Queue.shutdown` for queue termination.
(Contributed by Laurie Opperman in :gh:`104230`.)

opcode
------

Expand Down