raise :exc:`QueueShutDown`.
If *immediate* is true, the queue is terminated immediately.
- The queue is drained to be completely empty. All callers of
- :meth:`~Queue.join` are unblocked regardless of the number
- of unfinished tasks. Blocked callers of :meth:`~Queue.get`
+ 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 :meth:`~Queue.join`
+ are unblocked. Also, blocked callers of :meth:`~Queue.get`
are unblocked and will raise :exc:`QueueShutDown` because the
queue is empty.
raise :exc:`ShutDown`.
If *immediate* is true, the queue is terminated immediately.
- The queue is drained to be completely empty. All callers of
- :meth:`~Queue.join` are unblocked regardless of the number
- of unfinished tasks. Blocked callers of :meth:`~Queue.get`
+ 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 :meth:`~Queue.join`
+ are unblocked. Also, blocked callers of :meth:`~Queue.get`
are unblocked and will raise :exc:`ShutDown` because the
queue is empty.
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() and get() will be unblocked. If
- 'immediate', unblock callers of join() regardless of the
- number of unfinished tasks.
+ All blocked callers of put() and get() will be unblocked.
+
+ If 'immediate', the queue is drained and unfinished tasks
+ is reduced by the number of drained tasks. If unfinished tasks
+ is reduced to zero, callers of Queue.join are unblocked.
"""
self._is_shutdown = True
if immediate:
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() and get() will be unblocked. If
- 'immediate', callers of join() are unblocked regardless of
- the number of unfinished tasks.
+ All blocked callers of put() and get() will be unblocked.
+
+ If 'immediate', the queue is drained and unfinished tasks
+ is reduced by the number of drained tasks. If unfinished tasks
+ is reduced to zero, callers of Queue.join are unblocked.
'''
with self.mutex:
self.is_shutdown = True