MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / mask_sigint

Function mask_sigint

tensorpack/utils/concurrency.py:203–214  ·  view source on GitHub ↗

Returns: If called in main thread, returns a context where ``SIGINT`` is ignored, and yield True. Otherwise yield False.

()

Source from the content-addressed store, hash-verified

201
202@contextmanager
203def mask_sigint():
204 """
205 Returns:
206 If called in main thread, returns a context where ``SIGINT`` is ignored, and yield True.
207 Otherwise yield False.
208 """
209 if is_main_thread():
210 sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
211 yield True
212 signal.signal(signal.SIGINT, sigint_handler)
213 else:
214 yield False
215
216
217def start_proc_mask_signal(proc):

Callers 1

start_proc_mask_signalFunction · 0.85

Calls 1

is_main_threadFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…