recv
| Number | 0x11 |
|---|---|
| Signature | (port, timeout_ms) -> source; r1–r3 payload |
| Group | messaging |
| Since | 1.0 |
| Blocking | conditional |
Block waiting for a message on a port, returning once a sender rendezvouses.
What lands in r0 depends on how the sender sent. A plain send puts the sender’s PID in
r0. A call puts a freshly minted reply handle in r0 and the sender’s PID in r1 and the server answers with reply on that handle.
Check your protocol’s convention to know which to expect.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | port | Handle of the port to receive on |
r1 | timeout_ms | `TIMEOUT_POLL` to poll, `TIMEOUT_INFINITE` to block indefinitely, otherwise a deadline in ms |
Returns
r0 = source (see below); r1–r3 = payload words.
Errors
| Code | Condition |
|---|---|
ERR_TIMEOUT | Deadline expired, or a poll found no sender waiting |
ERR_BADHANDLE | Handle names no live port |
ERR_BADTYPE | Handle is not a port |
ERR_DEAD | The port was destroyed while waiting |