File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,14 +23,23 @@ Just like any other `react-parallel` the limited pool will run any closure you s
2323pool have a fixed number of threads running.
2424
2525``` php
26- $finite = new Limited(
26+ use React\EventLoop\Loop;
27+ use ReactParallel\EventLoop\EventLoopBridge;
28+ use ReactParallel\Pool\Infinite\Infinite;
29+ use ReactParallel\Pool\Limited\Limited;
30+ use function React\Async\async;
31+
32+ $limited = new Limited(
2733 new Infinite(new EventLoopBridge(), 1), // Another pool, preferably an inifinite pool
2834 100 // The amount of threads to start and keep running
2935);
3036$time = time();
31- echo 'Unix timestamp: ', $finite->run(function (int $time): int {
32- return $time;
33- }, [$time]), $time, PHP_EOL;
37+
38+ Loop::futureTick(async(static function () use ($limited, $time) {
39+ echo 'Unix timestamp: ', $limited->run(function (int $time): int {
40+ return $time;
41+ }, [$time]), $time, PHP_EOL;
42+ }));
3443```
3544
3645## License ##
You can’t perform that action at this time.
0 commit comments