MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / __wait_for_threads_to_finish

Method __wait_for_threads_to_finish

pydevd.py:2460–2493  ·  view source on GitHub ↗
(self, timeout)

Source from the content-addressed store, hash-verified

2458 self._create_check_output_thread()
2459
2460 def __wait_for_threads_to_finish(self, timeout):
2461 try:
2462 with self._wait_for_threads_to_finish_called_lock:
2463 wait_for_threads_to_finish_called = self._wait_for_threads_to_finish_called
2464 self._wait_for_threads_to_finish_called = True
2465
2466 if wait_for_threads_to_finish_called:
2467 # Make sure that we wait for the previous call to be finished.
2468 self._wait_for_threads_to_finish_called_event.wait(timeout=timeout)
2469 else:
2470 try:
2471
2472 def get_pydb_daemon_threads_to_wait():
2473 pydb_daemon_threads = set(self.created_pydb_daemon_threads)
2474 pydb_daemon_threads.discard(self.check_alive_thread)
2475 pydb_daemon_threads.discard(threading.current_thread())
2476 return pydb_daemon_threads
2477
2478 pydev_log.debug("PyDB.dispose_and_kill_all_pydevd_threads waiting for pydb daemon threads to finish")
2479 started_at = time.time()
2480 # Note: we wait for all except the check_alive_thread (which is not really a daemon
2481 # thread and it can call this method itself).
2482 while time.time() < started_at + timeout:
2483 if len(get_pydb_daemon_threads_to_wait()) == 0:
2484 break
2485 time.sleep(1 / 10.0)
2486 else:
2487 thread_names = [t.name for t in get_pydb_daemon_threads_to_wait()]
2488 if thread_names:
2489 pydev_log.debug("The following pydb threads may not have finished correctly: %s", ", ".join(thread_names))
2490 finally:
2491 self._wait_for_threads_to_finish_called_event.set()
2492 except:
2493 pydev_log.exception()
2494
2495 def dispose_and_kill_all_pydevd_threads(self, wait=True, timeout=0.5):
2496 """

Calls 3

exceptionMethod · 0.80
waitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected