public function __construct() { parent::__construct(new Thread(function () { $runner = new TaskRunner($this, new Environment()); yield $runner->run(); })); }
/** * @param string $operation * @param int $value * * @return \Generator * * @throws \Icicle\File\Exception\FileException */ private function change(string $operation, int $value) : \Generator { if (!$this->isOpen()) { throw new FileException('The file has been closed.'); } try { return yield from $this->worker->enqueue(new Internal\FileTask($operation, [$this->path, $value])); } catch (TaskException $exception) { $this->close(); throw new FileException(sprintf('%s failed.', $operation), $exception); } }
/** * {@inheritdoc} */ public function kill() { $this->worker->kill(); }
public function __construct() { $dir = dirname(dirname(__DIR__)) . '/bin'; parent::__construct(new ChannelledProcess($dir . '/worker.php', $dir)); }