threadlife.py¶
clew/threadlife.py
How a spawned thread ends: joined, detached, a daemon, or unknown — and the line that says so.
of
tuple[str | None, int | None] clew.threadlife.Lifecycles.of(self, Any spawn, str callee, str target, str kind)
How the thread a spawn call creates ends.
Source · 12 lines
def of(self, spawn: Any, callee: str, target: str, kind: str) -> tuple[str | None, int | None]:
"""Order: what the spawn expression itself says (chained, jthread, daemon), then the
handle's ends — inside the spawning function for a local, anywhere in the file otherwise.
@brief Lifecycle of one spawn.
@return Pair.
"""
if kind in NO_LIFECYCLE:
return None, None
found = self._inline(spawn, callee) or self._by_handle(*self._handle(spawn, callee, target))
return found or (LIFECYCLE_UNKNOWN, None)