The Io\Poll\Context classはじめにA polling context watches a set of handles and reports which of them are ready for reading or writing. It is the entry point of the polling API: handles are registered with Io\Poll\Context::add, and Io\Poll\Context::wait blocks until one of them is ready. The context relies on the polling mechanism of the operating system, represented by the Io\Poll\Backend enum. Unlike stream_select, the set of watched streams is kept between calls instead of being passed again on each of them. Objects of this class cannot be cloned or serialized. クラス概要Io\Poll
final
Context
/* メソッド */
public Io\Poll\Context::__construct(Io\Poll\Backend
$backend = Io\Poll\Backend::Auto)public Io\Poll\Watcher Io\Poll\Context::add(Io\Poll\Handle
$handle, array $events, mixed $data = null)public Io\Poll\Backend Io\Poll\Context::getBackend()
public array Io\Poll\Context::wait(Time\Durationnull
$timeout = null, intnull $maxEvents = null)例例1 Waiting for a stream to become readable 上の例の出力は以下となります。 int(0) reader: ping
|