@@ -324,7 +324,6 @@ def _shutdown_all_methods_in_many_threads(self, immediate):
324324 start_puts = threading .Event ()
325325 start_gets = threading .Event ()
326326 put = threading .Event ()
327- shutdown = threading .Event ()
328327
329328 n_gets_lock = threading .Lock ()
330329 n_gets = 0
@@ -358,10 +357,9 @@ def put_worker():
358357 _record_call (q .put , i )
359358 put .clear ()
360359
361- shutdown . set ( )
360+ _record_call ( q . shutdown , immediate )
362361
363362 # Should raise ShutDown
364- put .wait ()
365363 _record_call (q .put , 25 )
366364
367365 def get_worker ():
@@ -376,7 +374,9 @@ def get_worker():
376374 n_gets += 1
377375
378376 put .set ()
379- _record_call (q .get , False )
377+ _record_call (q .get )
378+
379+ q .task_done ()
380380
381381 put .set ()
382382 _record_call (q .get , False ) # should raise ShutDown if immediate
@@ -386,10 +386,6 @@ def join_worker():
386386 _record_call (q .join )
387387 queue_size_after_join .append (q .qsize ())
388388
389- def shutdown_worker ():
390- shutdown .wait ()
391- _record_call (q .shutdown , immediate )
392-
393389 def _start_thread (f ):
394390 thread = threading .Thread (target = _record_result , args = (f ,))
395391 thread .start ()
@@ -399,12 +395,10 @@ def _start_thread(f):
399395 _start_thread (put_worker ),
400396 * (_start_thread (get_worker ) for _ in range (4 )),
401397 * (_start_thread (join_worker ) for _ in range (2 )),
402- _start_thread (shutdown_worker ),
403398 ]
404399
405400 # Act
406401 start_puts .set ()
407- shutdown .wait ()
408402 for thread in threads :
409403 thread .join ()
410404
@@ -439,11 +433,6 @@ def _start_thread(f):
439433 join_worker_results = [r for f , r in results if f is join_worker ]
440434 self .assertListEqual (join_worker_results , [None , None ])
441435
442- shutdown_worker_result = next (
443- r for f , r in results if f is shutdown_worker
444- )
445- self .assertIsNone (shutdown_worker_result , None )
446-
447436 def test_shutdown_all_methods_in_many_threads (self ):
448437 return self ._shutdown_all_methods_in_many_threads (False )
449438
0 commit comments