Suspend all except the one passed as a parameter. :param except_thread:
(py_db, except_thread)
| 85 | |
| 86 | |
| 87 | def suspend_all_threads(py_db, except_thread): |
| 88 | """ |
| 89 | Suspend all except the one passed as a parameter. |
| 90 | :param except_thread: |
| 91 | """ |
| 92 | if PYDEVD_USE_SYS_MONITORING: |
| 93 | pydevd_sys_monitoring.update_monitor_events(suspend_requested=True) |
| 94 | |
| 95 | pydev_log.info("Suspending all threads except: %s", except_thread) |
| 96 | all_threads = pydevd_utils.get_non_pydevd_threads() |
| 97 | for t in all_threads: |
| 98 | if getattr(t, "pydev_do_not_trace", None): |
| 99 | pass # skip some other threads, i.e. ipython history saving thread from debug console |
| 100 | else: |
| 101 | if t is except_thread: |
| 102 | continue |
| 103 | info = mark_thread_suspended(t, CMD_THREAD_SUSPEND, main_suspend=False) |
| 104 | frame = info.get_topmost_frame(t) |
| 105 | |
| 106 | # Reset the tracing as in this case as it could've set scopes to be untraced. |
| 107 | if frame is not None: |
| 108 | try: |
| 109 | py_db.set_trace_for_frame_and_parents(t.ident, frame) |
| 110 | finally: |
| 111 | frame = None |
| 112 | |
| 113 | if PYDEVD_USE_SYS_MONITORING: |
| 114 | # After suspending the frames we need the monitoring to be reset. |
| 115 | pydevd_sys_monitoring.restart_events() |
no test coverage detected