2015-08-21 22:41:38 -05:00
|
|
|
<?php
|
|
|
|
namespace Icicle\Concurrent\Worker;
|
|
|
|
|
2015-08-22 16:27:44 -05:00
|
|
|
use Icicle\Concurrent\Threading\Thread;
|
2015-08-27 09:10:08 -05:00
|
|
|
use Icicle\Concurrent\Worker\Internal\TaskRunner;
|
2015-08-21 22:41:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A worker thread that executes task objects.
|
|
|
|
*/
|
2015-08-27 09:10:08 -05:00
|
|
|
class WorkerThread extends Worker
|
2015-08-21 22:41:38 -05:00
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
2015-08-27 09:10:08 -05:00
|
|
|
parent::__construct(new Thread(function () {
|
2015-09-09 23:29:41 -05:00
|
|
|
$runner = new TaskRunner($this, new Environment());
|
2015-08-27 09:10:08 -05:00
|
|
|
yield $runner->run();
|
|
|
|
}));
|
2015-08-21 22:41:38 -05:00
|
|
|
}
|
|
|
|
}
|