File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ def shutdown(self, immediate=False):
241241 n_items = self ._qsize ()
242242 while self ._qsize ():
243243 self ._get ()
244- self .unfinished_tasks -= n_items
244+ self .unfinished_tasks = max ( self . unfinished_tasks - n_items , 0 )
245245 self .not_empty .notify_all ()
246246 # release all blocked threads in `join()`
247247 self .all_tasks_done .notify_all ()
Original file line number Diff line number Diff line change @@ -575,14 +575,13 @@ def _shutdown_put_join(self, immediate):
575575 for func , params in thrds :
576576 threads .append (threading .Thread (target = func , args = params ))
577577 threads [- 1 ].start ()
578- if not immediate or immediate : # TODO: dedent (minimising Git diff)
579- self .assertEqual (q .unfinished_tasks , nb )
580- for i in range (nb ):
581- t = threading .Thread (target = q .task_done )
582- t .start ()
583- threads .append (t )
584- go .set ()
578+ self .assertEqual (q .unfinished_tasks , nb )
579+ for i in range (nb ):
580+ t = threading .Thread (target = q .task_done )
581+ t .start ()
582+ threads .append (t )
585583 q .shutdown (immediate )
584+ go .set ()
586585 for t in threads :
587586 t .join ()
588587
You can’t perform that action at this time.
0 commit comments