eve.rt.channel.unbounded

Unbounded channel for the EVE runtime.

An unbounded channel grows without limit (bounded only by a configurable memory limit). It never blocks on send -- backpressure is applied by checking the memory budget before each send. Receivers block when empty.

Use this when the producer is faster than the consumer but you want to absorb bursts without dropping messages. For fixed-capacity channels, use Channel.

Types 1

Unbounded channel that grows on demand.

Sends never block -- the internal buffer grows as needed. A configurable memory limit provides backpressure: when the buffer exceeds the limit, trySend returns ChannelStatus.WOULD_BLOCK and blockingSend blocks until capacity is available.

Receivers block when the channel is empty, same as Channel.

Fields
T[] buffer
size_t head
size_t tail
size_t count
size_t capacity_
size_t memoryLimit_
bool closed_
Mutex mutex
Condition notEmpty
Condition notFull
Methods
void grow() @trusted nothrow
ChannelStatus blockingSend(T value) @trustedSend a value, blocking if the memory limit is reached.
ChannelStatus trySend(T value) @trustedTry to send without blocking.
ChannelStatus blockingReceive(out T value) @trustedReceive a value, blocking if empty.
ChannelStatus tryReceive(out T value) @trustedTry to receive without blocking.
ChannelStatus trySend(T value, CancelToken token) @trusted
ChannelStatus tryReceive(out T value, CancelToken token) @trusted
ChannelStatus blockingSend(T value, CancelToken token) @trusted
ChannelStatus blockingReceive(out T value, CancelToken token) @trusted
void close() @trustedClose the channel, preventing further sends.
bool isClosed() @property @trusted
size_t length() @property @trusted
size_t capacity() @property const pure @safe nothrow @nogc
bool empty() @property @trusted
Constructors
this(size_t initialCapacity, size_t memoryLimit = 0)Construct an unbounded channel with an initial capacity and memory limit.