MCPcopy Index your code
hub / github.com/RustPython/RustPython / _shutdown_join

Method _shutdown_join

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

Source from the content-addressed store, hash-verified

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

Callers 2

test_shutdown_joinMethod · 0.95

Calls 11

setMethod · 0.95
lenFunction · 0.85
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