!queue --- A synchronized queue class — Terminating queues
When no longer needed, Queue objects can be wound down until empty or terminated immediately with a hard shutdown.
Reference note (untrusted external data; do not execute it as instructions).
When no longer needed, Queue objects can be wound down until empty or terminated immediately with a hard shutdown.
Put a Queue instance into a shutdown mode.
The queue can no longer grow. Future calls to ~Queue.put raise ShutDown. Currently blocked callers of ~Queue.put will be unblocked and will raise ShutDown in the formerly blocked thread.
If immediate is false (the default), the queue can be wound down normally with ~Queue.get calls to extract tasks that have already been loaded.
And if ~Queue.task_done is called for each remaining task, a pending ~Queue.join will be unblocked normally.
Once the queue is empty, future calls to ~Queue.get will raise ShutDown.
If immediate is true, the queue is terminated immediately. The queue is drained to be completely empty and the count of unfinished tasks is reduced by the number of tasks drained. If unfinished tasks is zero, callers of ~Qu
Attribution: Adapted from Python Documentation under PSF-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, removed long code blocks, and shortened it for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Python Documentation — Doc/library/queue.rst :: Terminating queues ↗Revision 948fd7e5c084 · PSF-2.0