mirror of
https://github.com/danog/parallel.git
synced 2024-12-11 16:49:51 +01:00
20 lines
458 B
PHP
20 lines
458 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Worker;
|
|
|
|
use Amp\Parallel\Forking\Fork;
|
|
use Amp\Parallel\Worker\Internal\TaskRunner;
|
|
use AsyncInterop\Promise;
|
|
|
|
/**
|
|
* A worker thread that executes task objects.
|
|
*/
|
|
class WorkerFork extends AbstractWorker {
|
|
public function __construct() {
|
|
parent::__construct(new Fork(function (): Promise {
|
|
$runner = new TaskRunner($this, new BasicEnvironment);
|
|
return $runner->run();
|
|
}));
|
|
}
|
|
}
|