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

Method _read_thread_func

monai/utils/profiling.py:219–233  ·  view source on GitHub ↗

Read results from the queue and add to self.results in a thread stared by `__enter__`.

(self)

Source from the content-addressed store, hash-verified

217 return self.read_thread is not None or not self.queue.empty()
218
219 def _read_thread_func(self):
220 """Read results from the queue and add to self.results in a thread stared by `__enter__`."""
221 while self._is_parent() and self._is_thread_active():
222 try:
223 result = self.queue.get()
224
225 if result is None:
226 break
227
228 self.add_result(result)
229 except Empty:
230 pass
231
232 if not (not self._is_parent() or self.queue.empty()):
233 raise AssertionError
234
235 def _put_result(self, name, timedelta, filename, lineno):
236 """Add a ProfileResult object to the queue."""

Callers

nothing calls this directly

Calls 4

_is_parentMethod · 0.95
_is_thread_activeMethod · 0.95
add_resultMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected