phasync
Waiting and timeouts / IOException

Exception

IOException

A stream wait failed: the value was no stream, the stream was closed while waited for, or polling failed.

Class synopsis#

class IOException extends Exception implements \Throwable, \Stringable {

}

Examples#

Example 1
phasync::run(function () {
    try {
        phasync::readable('not a stream');
    } catch (phasync\IOException $e) {
        echo $e->getMessage(), "\n";   // Not a valid stream resource
    }
});

See also#

  • phasync::readableSuspends the coroutine until the stream can be read without blocking, and returns the stream.
  • phasync::writableSuspends the coroutine until the stream can be written without blocking, and returns the stream.