PHP code example of react-parallel / limited-pool
1. Go to this page and download the library: Download react-parallel/limited-pool library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
react-parallel / limited-pool example snippets
$loop = Factory::create();
$finite = new Limited(
new Infinite($loop, new EventLoopBridge($loop), 1), // Another pool, preferably an inifinite pool
100 // The amount of threads to start and keep running
);
$time = time();
$finite->run(function (int $time): int {
return $time;
}, [$time])->then(function (int $time): void {
echo 'Unix timestamp: ', $time, PHP_EOL;
})->done();