MCPcopy Create free account
hub / github.com/microsoft/debugpy / notify_thread_created

Method notify_thread_created

src/debugpy/_vendored/pydevd/pydevd.py:1758–1781  ·  view source on GitHub ↗
(self, thread_id, thread, use_lock=True)

Source from the content-addressed store, hash-verified

1756 self.writer.add_command(self.cmd_factory.make_skipped_step_in_because_of_filters(self, frame))
1757
1758 def notify_thread_created(self, thread_id, thread, use_lock=True):
1759 if self.writer is None:
1760 # Protect about threads being created before the communication structure is in place
1761 # (note that they will appear later on anyways as pydevd does reconcile live/dead threads
1762 # when processing internal commands, albeit it may take longer and in general this should
1763 # not be usual as it's expected that the debugger is live before other threads are created).
1764 return
1765
1766 with self._lock_running_thread_ids if use_lock else NULL:
1767 if not self._enable_thread_notifications:
1768 return
1769
1770 if thread_id in self._running_thread_ids:
1771 return
1772
1773 additional_info = set_additional_thread_info(thread)
1774 if additional_info.pydev_notify_kill:
1775 # After we notify it should be killed, make sure we don't notify it's alive (on a racing condition
1776 # this could happen as we may notify before the thread is stopped internally).
1777 return
1778
1779 self._running_thread_ids[thread_id] = thread
1780
1781 self.writer.add_command(self.cmd_factory.make_thread_created_message(thread))
1782
1783 def notify_thread_not_alive(self, thread_id, use_lock=True):
1784 """if thread is not alive, cancel trace_dispatch processing"""

Callers 4

runMethod · 0.95
__call__Method · 0.80

Calls 3

add_commandMethod · 0.45

Tested by

no test coverage detected