public function __construct() { parent::__construct(new Thread(function () { $runner = new TaskRunner($this, new Environment()); yield $runner->run(); })); }
public function __construct() { parent::__construct(new Fork(function () : \Generator { $runner = new TaskRunner($this, new BasicEnvironment()); return yield from $runner->run(); })); }
exit(1); } require $autoloadPath; use Icicle\Concurrent\Sync\Channel; use Icicle\Concurrent\Sync\Internal\ExitFailure; use Icicle\Concurrent\Sync\Internal\ExitSuccess; use Icicle\Concurrent\Worker\Environment; use Icicle\Concurrent\Worker\Internal\TaskRunner; use Icicle\Coroutine; use Icicle\Loop; use Icicle\Stream; Coroutine\create(function () { $channel = new Channel(Stream\stdin(), Stream\stdout()); $environment = new Environment(); $runner = new TaskRunner($channel, $environment); try { $result = new ExitSuccess(yield $runner->run()); } catch (Exception $exception) { $result = new ExitFailure($exception); } yield $channel->send($result); })->done(); Loop\run();