File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed 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
23
23
pool have a fixed number of threads running.
24
24
25
25
``` 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(
27
33
new Infinite(new EventLoopBridge(), 1), // Another pool, preferably an inifinite pool
28
34
100 // The amount of threads to start and keep running
29
35
);
30
36
$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
+ }));
34
43
```
35
44
36
45
## License ##
You can’t perform that action at this time.
0 commit comments