/** * 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]); }
/** * @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); }
public static function init() { if (!(self::$supported = extension_loaded('eio'))) { Daemon::log('FS: missing pecl-eio, Filesystem I/O performance compromised. Consider installing pecl-eio.'); return; } self::$fdCache = new CappedCacheStorageHits(self::$fdCacheSize); eio_init(); }
public function listen() { if (0 === $this->requests++) { if ($this->poll->isFreed()) { \eio_init(); $this->poll = $this->createPoll(); } $this->poll->listen(); } }
/** * Initialize FS driver * @return void */ public static function init() { if (!Daemon::$config->eioenabled->value) { self::$supported = false; return; } if (!(self::$supported = Daemon::loadModuleIfAbsent('eio', self::$eioVer))) { Daemon::log('FS: missing pecl-eio >= ' . self::$eioVer . '. Filesystem I/O performance compromised. Consider installing pecl-eio. `pecl install http://pecl.php.net/get/eio`'); return; } self::$fdCache = new CappedStorageHits(self::$fdCacheSize); eio_init(); }
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 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]); }