envzn
0.8 · beta · not released

Library / Concurrency / Communication / Channel

CLASSIMPLEMENTS Shareable

Channel

Typed, bounded, point-to-point message channel.

Constructors 1

INIT(int64 capacity, BackpressurePolicy policy)

Methods 7

MODIFY METHOD send(T value) RETURNS STATUS
modifies

PUBLIC API Enqueue value. Pipe-XOR STATUS. The bare-named (owning) form consumes the source — the value is moved into the buffer. At capacity, behaviour follows the BackpressurePolicy. Returns FAILURE if the channel is closed.

MODIFY METHOD receive() RETURNS | T
modifies

Remove and return the front value. Pipe-XOR: SUCCESS populates value; blocks while the buffer is empty and the channel is open. Returns FAILURE once the channel is closed AND drained, so a WHILE ch->receive() DO { … } loop terminates on close.

MODIFY METHOD tryReceive() RETURNS | T
modifies

Non-blocking receive. Pipe-XOR: SUCCESS returns the front value if one is buffered; FAILURE immediately if the buffer is empty (never blocks). A WHILE ch->tryReceive() DO { … } loop drains whatever is currently buffered and then exits.

MODIFY METHOD close() RETURNS void
modifies

Sticky shutdown. Wakes every blocked sender and receiver so they re-test their predicate and exit. Idempotent.

METHOD shareableKind() RETURNS String
reads

Shareable marker — short type tag for debug printers / logs.

METHOD isClosed() RETURNS boolean
reads

Non-blocking state read. TRUE once close() (or scope-exit CLEANUP) has run.

METHOD size() RETURNS int64
reads

Current buffered count. Snapshot under the lock — advisory only (the value may change the instant the lock is released).