Returns: If called in main thread, returns a context where ``SIGINT`` is ignored, and yield True. Otherwise yield False.
()
| 201 | |
| 202 | @contextmanager |
| 203 | def 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 | |
| 217 | def start_proc_mask_signal(proc): |
no test coverage detected
searching dependent graphs…