MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __exit__

Method __exit__

monai/utils/profiling.py:281–295  ·  view source on GitHub ↗

Terminate the read thread cleanly and reset tracing if needed.

(self, exc_type, exc_value, traceback)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 1

_is_parentMethod · 0.95

Tested by

no test coverage detected