thread::Thread
The owning handle to one spawned thread — obtained from thread.spawn, never constructed directly by a cheatah program.
Move-only (there is exactly one owner of a thread), and the destructor JOINS: dropping the handle — normally, via with, or during unwinding — always waits for the worker to finish, on every exit path. There is no detach.
If the worker threw and join() never surfaced it, the destructor reports one line on stderr (cheatah thread: unhandled exception in thread: ...) — the honest fallback, since a destructor must not throw.
the handle itself is not internally synchronized — drive a given Thread from one thread at a time (the worker it owns is, of course, another thread; join() is the synchronization point with it).
ThreadCompileRun.SpawnJoinStdlibE2E.ThreadFunctions
Thread · 3 overloads
The grant path used by spawn: adopt a running thread and its shared error slot.
Public but not part of the cheatah surface (no module factory returns the pieces), matching the memory module's no-friend stance.
t | the running thread to own. |
state | the error slot the spawn trampoline writes into. |
O(1).
none (moves the handles in).
the worker is already running when the handle adopts it.
CheatahThread.SpawnRunsTheWorkeroperator= · 2 overloads
Move-assign: the destination first settles its own thread (join + report an unobserved error), then adopts the source's.
other | the handle to take the thread from (left non-joinable). |
this handle, now owning other's thread.
O(join).
none.
may block: the destination joins its old worker before adopting the new one.
Joins if still joinable; reports an unobserved worker exception on stderr (one line).
O(join) — blocks until the worker finishes.
none.
blocks the destroying thread until the worker finishes — on every exit path, including unwinding.
Block until the worker finishes.
If the worker escaped with an exception, RE-THROW it here — catch it with try { t.join() } catch e { ... }. Joining a thread that was already joined (or moved away) raises.
O(join) — blocks until the worker finishes.
none.
blocks the calling thread; the worker's writes happen-before join() returns (the join is the synchronization). One-shot — a second join raises.
ThreadCompileRun.JoinCatchesWorkerRaiseStdlibE2E.ThreadDoes this handle still own a running/unjoined thread?
true until join() (or a move-away); false after.
O(1).
none.
CheatahThread.JoinableLifecycleThreadCompileRun.Joinable