The Io\Poll\Event enumはじめにThe Io\Poll\Event enum lists the conditions an Io\Poll\Context can watch for and report, together with two modifiers that change how they are reported. A list of cases is passed to Io\Poll\Context::add, Io\Poll\Watcher::modify and Io\Poll\Watcher::modifyEvents, and returned by Io\Poll\Watcher::getWatchedEvents and Io\Poll\Watcher::getTriggeredEvents. 列挙型概要Io\Poll Event Read Data is available for reading. For a listening socket, a connection is ready to be accepted. This event is also reported when the end of the stream is reached, for example when the peer closed a TCP connection. Write Data can be written without blocking. Error An error occurred on the handle. This event is reported even if it was not requested. HangUp The handle was hung up, for example because the other end of a pipe or of a Unix domain socket pair was closed. This event is reported even if it was not requested. ReadHangUp The other end closed the connection or shut down its writing half. This event is only reported if it was requested, and only byIo\Poll\Backend::Epoll.
OneShot
A modifier: the watcher is reported once, and then stays silent until
its events are set again with
Io\Poll\Watcher::modify or
Io\Poll\Watcher::modifyEvents.
EdgeTriggered
A modifier: the watcher is reported when its state changes, for example
when new data arrives, instead of for as long as the condition holds.
It is only supported by the backends for which
Io\Poll\Backend::supportsEdgeTriggering
returns true.
例例1 Level-triggered and edge-triggered reporting 上の例の出力は、 たとえば以下のようになります。 int(1) int(0) int(1) 参考
|