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
Success/Failure - Fails when Channel is closed or timeout is reached.
See Implementation
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