1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-26 20:34:40 +01:00
parallel/examples/worker-thread.php
Aaron Piotrowski 3c48042c30 Add Process
2015-08-26 21:19:57 -05:00

19 lines
404 B
PHP
Executable File

#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/autoload.php';
use Icicle\Concurrent\Worker\HelloTask;
use Icicle\Concurrent\Worker\WorkerThread;
use Icicle\Coroutine;
use Icicle\Loop;
Coroutine\create(function () {
$worker = new WorkerThread();
$worker->start();
$returnValue = (yield $worker->enqueue(new HelloTask()));
yield $worker->shutdown();
})->done();
Loop\run();