/** * We have to keep a static reference of eio event streams * because if we don't garbage collection can unload eio's * underlying pipe via a system close() call before it's * finished and generate a SIGPIPE. */ public function __construct() { if (empty(self::$stream)) { \eio_init(); self::$stream = \eio_get_event_stream(); } $this->callableDecrementor = function () { \call_user_func($this->incrementor, -1); }; $this->incrementor = function ($increment) { switch ($increment) { case 1: case -1: $this->pending += $increment; break; default: throw new FilesystemException("Invalid pending event increment; 1 or -1 required"); } if ($this->pending === 0) { \Amp\disable($this->watcher); } elseif ($this->pending === 1) { \Amp\enable($this->watcher); } }; $this->watcher = \Amp\onReadable(self::$stream, function () { while (\eio_npending()) { \eio_poll(); } }, $options = ["enable" => false]); }
private function createPoll() : Io { return Loop\poll(\eio_get_event_stream(), function () { while (\eio_npending()) { \eio_poll(); } }, true); }
/** * @param LoopInterface $loop * @param array $options */ public function __construct(LoopInterface $loop, array $options = []) { eio_init(); $this->loop = $loop; $this->fd = eio_get_event_stream(); $this->openFlagResolver = new Eio\OpenFlagResolver(); $this->permissionFlagResolver = new Eio\PermissionFlagResolver(); $this->applyConfiguration($options); }
/** * Initialize main FS event * @return void */ public static function initEvent() { if (!self::$supported) { return; } self::updateConfig(); self::$fd = eio_get_event_stream(); self::$ev = new \Event(Daemon::$process->eventBase, self::$fd, \Event::READ | \Event::PERSIST, function ($fd, $events, $arg) { while (eio_nreqs()) { eio_poll(); } }); self::$ev->add(); }
/** * Initialize main FS event * @return void */ public static function initEvent() { if (!self::$supported) { return; } self::updateConfig(); self::$fd = eio_get_event_stream(); self::$ev = EventLoop::$instance->event(self::$fd, \Event::READ | \Event::PERSIST, function ($fd, $events, $arg) { while (eio_nreqs()) { eio_poll(); } }); self::$ev->add(); }
public function __construct() { if (self::$eio === null) { \eio_init(); $eio = @\eio_get_event_stream(); \stream_set_blocking($eio, false); \stream_set_read_buffer($eio, 0); self::$eio = $eio; self::$callback = function () { while (\eio_npending()) { \eio_poll(); } }; } }
public static function initEvent() { if (!self::$supported) { return; } self::updateConfig(); self::$ev = event_new(); self::$fd = eio_get_event_stream(); event_set(self::$ev, self::$fd, EV_READ | EV_PERSIST, function ($fd, $events, $arg) { if (eio_nreqs()) { eio_poll(); } }); event_base_set(self::$ev, Daemon::$process->eventBase); event_add(self::$ev); }
public function __construct() { if (empty(self::$isEioInitialized)) { \eio_init(); self::$isEioInitialized = true; } $this->stream = \eio_get_event_stream(); $this->callableDelReq = function () { $this->decrementPending(); }; $this->internalIncrement = function () { $this->incrementPending(); }; $this->internalDecrement = function () { $this->decrementPending(); }; $this->watcher = \Amp\onReadable($this->stream, function () { while (\eio_npending()) { \eio_poll(); } }, $options = ["enable" => false]); }