MCPcopy Index your code
hub / github.com/python/cpython / _shutdown_join

Method _shutdown_join

Lib/test/test_queue.py:543–568  ·  view source on GitHub ↗
(self, immediate)

Source from the content-addressed store, hash-verified

541 return self._shutdown_put(True)
542
543 def _shutdown_join(self, immediate):
544 q = self.type2test()
545 results = []
546 q.put("Y")
547 go = threading.Event()
548 nb = q.qsize()
549
550 thrds = (
551 (self._join, (q, results)),
552 (self._join, (q, results)),
553 )
554 threads = []
555 for func, params in thrds:
556 threads.append(threading.Thread(target=func, args=params))
557 threads[-1].start()
558 if not immediate:
559 res = []
560 for i in range(nb):
561 threads.append(threading.Thread(target=self._get_task_done, args=(q, go, res)))
562 threads[-1].start()
563 q.shutdown(immediate)
564 go.set()
565 for t in threads:
566 t.join()
567
568 self.assertEqual(results, [True]*len(thrds))
569
570 def test_shutdown_immediate_join(self):
571 return self._shutdown_join(True)

Callers 2

test_shutdown_joinMethod · 0.95

Calls 10

setMethod · 0.95
type2testMethod · 0.80
EventMethod · 0.80
putMethod · 0.45
qsizeMethod · 0.45
appendMethod · 0.45
startMethod · 0.45
shutdownMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected