MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / ThreadsSuspendedSingleNotification

Class ThreadsSuspendedSingleNotification

pydevd.py:474–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472
473
474class ThreadsSuspendedSingleNotification(AbstractSingleNotificationBehavior):
475 __slots__ = AbstractSingleNotificationBehavior.__slots__ + ["multi_threads_single_notification", "_callbacks", "_callbacks_lock"]
476
477 def __init__(self, py_db):
478 AbstractSingleNotificationBehavior.__init__(self, py_db)
479 # If True, pydevd will send a single notification when all threads are suspended/resumed.
480 self.multi_threads_single_notification = False
481 self._callbacks_lock = threading.Lock()
482 self._callbacks = []
483
484 def add_on_resumed_callback(self, callback):
485 with self._callbacks_lock:
486 self._callbacks.append(callback)
487
488 @overrides(AbstractSingleNotificationBehavior.send_resume_notification)
489 def send_resume_notification(self, thread_id):
490 py_db = self._py_db()
491 if py_db is not None:
492 py_db.writer.add_command(py_db.cmd_factory.make_thread_resume_single_notification(thread_id))
493
494 with self._callbacks_lock:
495 callbacks = self._callbacks
496 self._callbacks = []
497
498 for callback in callbacks:
499 callback()
500
501 @overrides(AbstractSingleNotificationBehavior.send_suspend_notification)
502 def send_suspend_notification(self, thread_id, thread, stop_reason):
503 py_db = self._py_db()
504 if py_db is not None:
505 py_db.writer.add_command(py_db.cmd_factory.make_thread_suspend_single_notification(py_db, thread_id, thread, stop_reason))
506
507 @overrides(AbstractSingleNotificationBehavior.notify_thread_suspended)
508 @contextmanager
509 def notify_thread_suspended(self, thread_id, thread, stop_reason):
510 if self.multi_threads_single_notification:
511 pydev_log.info("Thread suspend mode: single notification")
512 with AbstractSingleNotificationBehavior.notify_thread_suspended(self, thread_id, thread, stop_reason):
513 yield
514 else:
515 pydev_log.info("Thread suspend mode: NOT single notification")
516 yield
517
518
519class _Authentication(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected