List view
- No due date•2/2 issues closed
Fully reworked the event loop public facing API to utilize fibers: ## Channels From: ```php use parallel\Channel; use React\EventLoop\Factory; use ReactParallel\EventLoop\EventLoopBridge; $loop = Factory::create(); $eventLoopBridge = new EventLoopBridge($loop); $channel = new Channel(Channel::Infinite); $eventLoopBridge->observe($channel)->subscribe(function (string $message) { echo $message, PHP_EOL; }); $loop->futureTick(function () use ($channel): void { $channel->send('Hello World!'); $channel->close(); }); $loop->run(); ``` To: ```php use parallel\Channel; use React\EventLoop\Loop; use ReactParallel\EventLoop\EventLoopBridge; use function React\Async\async; use function React\Async\await; use function React\Promise\Timer\sleep; $eventLoopBridge = new EventLoopBridge(); Loop::futureTick(async(static function () use ($eventLoopBridge) { /** @var Channel<string> */ $channel = new Channel(Channel::Infinite); Loop::futureTick(async(function () use ($channel): void { $channel->send('Hello World!'); // Don't close the channel right after writing to it, // as it will be closed on both ends and the other // thread won't receive your message await(sleep(1)); $channel->close(); })); foreach ($eventLoopBridge->observe($channel) as $message) { echo $message, PHP_EOL; } })); ``` ## Futures From: ```php use parallel\Channel; use React\EventLoop\Factory; use ReactParallel\EventLoop\EventLoopBridge; use function parallel\run; $loop = Factory::create(); $eventLoopBridge = new EventLoopBridge($loop); $future = run(function (): string { return 'Hello World!'; }); $channel = new Channel(Channel::Infinite); $eventLoopBridge->await($future)->then(function (string $message) { echo $message, PHP_EOL; }); $loop->run(); ``` To: ```php use React\EventLoop\Loop; use ReactParallel\EventLoop\EventLoopBridge; use function parallel\run; use function React\Async\async; $eventLoopBridge = new EventLoopBridge(); Loop::futureTick(async(static function () use ($eventLoopBridge) { $future = run(function (): string { return 'Hello World!'; }); echo $eventLoopBridge->await($future), PHP_EOL; })); ```
No due date•38/38 issues closedIntroduces a scaling timer inside the event loop bridge. Making it use less CPU by scaling between 100 and 1000 checks for new events per second.
No due date•5/5 issues closed## Metrics Added support for metrics through [`wyrihaximus/metrics`](https://github.com/wyrihaximus/php-metrics): ```php use React\EventLoop\Factory; use ReactParallel\EventLoop\EventLoopBridge; use ReactParallel\EventLoop\Metrics; use WyriHaximus\Metrics\Configuration; use WyriHaximus\Metrics\InMemory\Registry; $loop = Factory::create(); $eventLoopBridge = (new EventLoopBridge($loop))->withMetrics(Metrics::create(new Registry(Configuration::create()))); ```
No due date•2/2 issues closed