Channel.write

Write a message to the Channel with an optional timeout

Unbuffered mode:

If a reader is already blocked on the Channel, writer copies the message to reader's buffer and wakes up the reader by yielding

If no reader is ready in the wait queue, writer appends itself to write wait queue and blocks

Buffered mode:

If a reader is already blocked on the Channel, writer copies the message to reader's buffer and wakes up the reader and returns immediately.

If the buffer is not full writer puts the message in the Channel buffer and returns immediately

If buffer is full writer appends itself to write wait queue and blocks

If Channel is closed, it returns immediately with a failure, regardless of the operation mode

Param: val = Message to write to Channel duration = Timeout duration

class Channel(T)
nothrow
bool
write
()
(
auto ref T val
,
Duration duration = Duration.init
)

Return Value

Type: bool

Success/Failure - Fails when Channel is closed or timeout is reached.

Meta