PHP code example of 6dreams / parallel-pool

1. Go to this page and download the library: Download 6dreams/parallel-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/ */

    

6dreams / parallel-pool example snippets


$pool = new Pool(
    __DIR__ . '/bootstrap_or_autoloader.php',
    2,
    static function (ThreadConfigInterface $config) {
        echo $config->getId() . "\n";
    }
);

$pool->submit([]);
$pool->submit([]);
$pool->submit([]);
$pool->submit([]);
$pool->submit([]);

while ($pool->collect()) {
    \usleep(0);
}