Terminate the read thread cleanly and reset tracing if needed.
(self, exc_type, exc_value, traceback)
| 279 | return self |
| 280 | |
| 281 | def __exit__(self, exc_type, exc_value, traceback): |
| 282 | """Terminate the read thread cleanly and reset tracing if needed.""" |
| 283 | if not self._is_parent(): |
| 284 | raise AssertionError |
| 285 | |
| 286 | self.queue.put(None) |
| 287 | |
| 288 | read_thread = cast(threading.Thread, self.read_thread) |
| 289 | self.read_thread = None |
| 290 | |
| 291 | read_thread.join() |
| 292 | |
| 293 | if self.call_selector is not None: |
| 294 | threading.settrace(None) # type: ignore |
| 295 | sys.settrace(None) |
| 296 | |
| 297 | def add_result(self, result: ProfileResult) -> None: |
| 298 | """Add a result in a thread-safe manner to the internal results dictionary.""" |
nothing calls this directly
no test coverage detected