tjoin
| Number | 0x0A |
|---|---|
| Signature | (tid) -> exit_status or -err |
| Group | task |
| Since | 1.0 |
| Blocking | true |
Block until a thread in the same process exits, returning its exit status. If the thread has already exited, returns its status immediately without blocking.
Only threads within the caller’s own process can be joined since a tid is an identifier inside a process, not a cross-process handle.
Pitfalls
The exit status is returned directly in r0, in the same register the error codes use. A
thread that exits with a small negative status (e.g. tquit(-2)) is indistinguishable from
an error like ERR_NOENT. Reserve non-negative exit codes, or carry status out-of-band.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | tid | Thread ID to join, within the calling process |
Returns
The joined thread's exit status.
Errors
| Code | Condition |
|---|---|
ERR_NOENT | No thread with that tid exists |
ERR_NOPERM | The thread belongs to another process |