Method
WriteChannelInterface::write
Sends a value, and waits while the channel cannot take it: for a reader on an unbuffered channel, for room on a full buffer.
Description#
public WriteChannelInterface::write(
mixed $value,
float $timeout = PHP_FLOAT_MAX
): voidAny value is accepted: a channel is in-memory communication between coroutines of one process, and nothing is serialized.
Parameters#
- $value mixed
- What to send
- $timeout float = PHP_FLOAT_MAX
- Seconds to wait at most
Errors / Exceptions#
| Exception | When |
|---|---|
ChannelException | If the channel is closed, or the creator of the channel waits on it alone, see WriteChannelInterface::activate |
TimeoutException | If the value could not be sent in time |
See also#
ReadChannelInterface::readReturns the next value, and waits while there is none and the channel is open.