src/Pipe/WritablePipe.php
public function await(float $timeout = 0): \Generator
    {
        if (!$this->isWritable()) {
            throw new UnwritableException('The stream is no longer writable.');
        }

        if (null === $this->await) {
            $this->await = $this->createAwait($this->getResource(), $this->writeQueue);
            $this->await->listen($timeout);
        } elseif (!$this->await->isPending()) {
            $this->await->listen($timeout);
        }

        $delayed = new Delayed($this->onCancelled);
        $this->writeQueue->push(['', 0, $timeout, $delayed]);

        try {
            return yield $delayed;
        } catch (Throwable $exception) {
            $this->free($exception);
            throw $exception;
        }
    }
public function await(float $timeout = 0): \Generator
    {
        if (!$this->isWritable()) {
            throw new UnwritableException('The stream is no longer writable.');
        }

        if (null === $this->await) {
            $this->await = $this->createAwait($this->getResource(), $this->writeQueue);
            $this->await->listen($timeout);
        } elseif (!$this->await->isPending()) {
            $this->await->listen($timeout);
        }

        $delayed = new Delayed($this->onCancelled);
        $this->writeQueue->push(['', 0, $timeout, $delayed]);

        try {
            return yield $delayed;
        } catch (Throwable $exception) {
            $this->free($exception);
            throw $exception;
        }
    }
@coroutine

Returns a coroutine that is fulfilled when the stream is ready to receive data (output buffer is not full).

@param float|int $timeout Number of seconds until the returned promise is rejected with a TimeoutException
if the data cannot be written to the stream. Use null for no timeout.

@return \Generator

@resolve int Always resolves with 0.

@throws \Icicle\Stream\Exception\UnwritableException If the stream is no longer writable.
@throws \Icicle\Stream\Exception\ClosedException If the stream has been closed.