@@ -72,10 +72,11 @@ def task_done(self):
72
72
have been processed (meaning that a task_done() call was received
73
73
for every item that had been put() into the queue).
74
74
75
+ shutdown(immediate=True) calls task_done() for each remaining item in
76
+ the queue.
77
+
75
78
Raises a ValueError if called more times than there were items
76
79
placed in the queue.
77
-
78
- Raises ShutDown if the queue has been shut down immediately.
79
80
'''
80
81
with self .all_tasks_done :
81
82
unfinished = self .unfinished_tasks - 1
@@ -93,8 +94,6 @@ def join(self):
93
94
to indicate the item was retrieved and all work on it is complete.
94
95
95
96
When the count of unfinished tasks drops to zero, join() unblocks.
96
-
97
- Raises ShutDown if the queue has been shut down immediately.
98
97
'''
99
98
with self .all_tasks_done :
100
99
while self .unfinished_tasks :
@@ -227,18 +226,17 @@ def get_nowait(self):
227
226
return self .get (block = False )
228
227
229
228
def shutdown (self , immediate = False ):
230
- '''Shut-down the queue, making queue gets and puts raise.
229
+ '''Shut-down the queue, making queue gets and puts raise ShutDown .
231
230
232
231
By default, gets will only raise once the queue is empty. Set
233
232
'immediate' to True to make gets raise immediately instead.
234
233
235
234
All blocked callers of put() will be unblocked, and also get()
236
- and join() if 'immediate'. The ShutDown exception is raised.
235
+ and join() if 'immediate'.
237
236
'''
238
237
with self .mutex :
239
238
self .is_shutdown = True
240
239
if immediate :
241
- n_items = self ._qsize ()
242
240
while self ._qsize ():
243
241
self ._get ()
244
242
if self .unfinished_tasks > 0 :
0 commit comments