recv

Number0x11
Signature(port, timeout_ms) -> source; r1–r3 payload
Groupmessaging
Since1.0
Blockingconditional

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

RegisterNameDescription
r0portHandle of the port to receive on
r1timeout_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

CodeCondition
ERR_TIMEOUTDeadline expired, or a poll found no sender waiting
ERR_BADHANDLEHandle names no live port
ERR_BADTYPEHandle is not a port
ERR_DEADThe port was destroyed while waiting

See also