1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-27 04:44:56 +01:00
parallel/examples/worker-pool.php
2015-08-28 20:30:53 -05:00

22 lines
464 B
PHP
Executable File

#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/autoload.php';
use Icicle\Concurrent\Worker;
use Icicle\Concurrent\Worker\HelloTask;
use Icicle\Coroutine;
use Icicle\Loop;
use Icicle\Promise;
Coroutine\create(function () {
$returnValues = (yield Promise\all([
Worker\enqueue(new HelloTask()),
Worker\enqueue(new HelloTask()),
Worker\enqueue(new HelloTask()),
]));
var_dump($returnValues);
})->done();
Loop\run();