mirror of
https://github.com/danog/parallel.git
synced 2024-11-30 04:39:01 +01:00
23 lines
576 B
PHP
Executable File
23 lines
576 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([
|
|
new Coroutine\Coroutine(Worker\enqueue(new HelloTask())),
|
|
new Coroutine\Coroutine(Worker\enqueue(new HelloTask())),
|
|
new Coroutine\Coroutine(Worker\enqueue(new HelloTask())),
|
|
]));
|
|
var_dump($returnValues);
|
|
|
|
yield Worker\pool()->shutdown();
|
|
})->done();
|
|
|
|
Loop\run();
|