Atom

task.receive()

Dequeues a message or observes a closed queue.

Signature

task.receive(channel[, timeout])

Parameters

Channel and optional duration or null, default unlimited.

Returns

Dictionary with open and value. open is false only when closed and drained.

Behavior

Waits when empty and open. A queued null has open = true.

Errors

Timeout, interruption or invalid channel.

Example

Atom
use task
q = task.channel()
task.send(q, null)
task.close(q)
assert(task.receive(q).open and not task.receive(q).open)