MCPcopy Create free account
hub / github.com/brmmm3/fastthreadpool / shutdown

Method shutdown

fastthreadpool/fastthreadpool.py:792–817  ·  view source on GitHub ↗
(self, timeout=None, soon=False)

Source from the content-addressed store, hash-verified

790 self._job_cnt.release()
791
792 def shutdown(self, timeout=None, soon=False):
793 for _ in range(len(self._children)):
794 if soon is True:
795 self._jobs.appendleft(None)
796 elif soon is False:
797 self._jobs_append(None)
798 while self._job_cnt._value <= 0:
799 self._job_cnt.release()
800 self._shutdown = True
801 t = None if timeout is None else _time() + timeout
802 for thread in tuple(self._children):
803 self._join_thread(thread, t)
804 if t is not None and (_time() > t):
805 self._delayed_cancel()
806 if self._children:
807 return False
808 if self._thr_done is not None:
809 while self._done_cnt._value <= 0:
810 self._done_cnt.release()
811 self._join_thread(self._thr_done, t)
812 if self._thr_failed is not None:
813 while self._failed_cnt._value <= 0:
814 self._failed_cnt.release()
815 self._join_thread(self._thr_failed, t)
816 self._idle_event.set()
817 return True
818
819 def join(self, timeout=None):
820 return self.shutdown(timeout, False)

Callers 15

__exit__Method · 0.95
joinMethod · 0.95
mapMethod · 0.95
map_no_doneMethod · 0.95
map_failed_cbMethod · 0.95
map_genMethod · 0.95
map_gen_failed_cbMethod · 0.95
submitMethod · 0.95
submit_result_idMethod · 0.95
submit_genMethod · 0.95

Calls 3

_join_threadMethod · 0.95
_delayed_cancelMethod · 0.95
releaseMethod · 0.80

Tested by

no test coverage detected