mirror of
https://github.com/amphp/parallel.git
synced 2025-02-22 05:42:36 +01:00
20 lines
474 B
PHP
20 lines
474 B
PHP
<?php
|
|
namespace Icicle\Concurrent\Worker;
|
|
|
|
use Icicle\Concurrent\Threading\Thread;
|
|
use Icicle\Concurrent\Worker\Internal\TaskRunner;
|
|
|
|
/**
|
|
* A worker thread that executes task objects.
|
|
*/
|
|
class WorkerThread extends AbstractWorker
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct(new Thread(function (): \Generator {
|
|
$runner = new TaskRunner($this, new BasicEnvironment());
|
|
return yield from $runner->run();
|
|
}));
|
|
}
|
|
}
|