mirror of
https://github.com/amphp/parallel.git
synced 2025-01-17 12:48:34 +01:00
Rename DefaultWorker to ContextWorker and make it internal
This commit is contained in:
parent
0a86594cf3
commit
f8bad14018
@ -99,9 +99,7 @@ class FetchTask implements Task
|
||||
```
|
||||
|
||||
```php
|
||||
use Amp\Parallel\Worker\DefaultWorker;
|
||||
|
||||
$worker = new DefaultWorker();
|
||||
$worker = Amp\Parallel\Worker\createWorker();
|
||||
$task = new FetchTask('https://amphp.org');
|
||||
|
||||
$execution = $worker->submit($task);
|
||||
|
@ -6,6 +6,7 @@ use Amp\Cancellation;
|
||||
use Amp\ForbidCloning;
|
||||
use Amp\ForbidSerialization;
|
||||
use Amp\Parallel\Context\ContextFactory;
|
||||
use Amp\Parallel\Worker\Internal\ContextWorker;
|
||||
use function Amp\Parallel\Context\contextFactory;
|
||||
|
||||
/**
|
||||
@ -39,6 +40,6 @@ final class DefaultWorkerFactory implements WorkerFactory
|
||||
$script[] = $this->bootstrapPath;
|
||||
}
|
||||
|
||||
return new DefaultWorker(($this->contextFactory ?? contextFactory())->start($script, $cancellation));
|
||||
return new ContextWorker(($this->contextFactory ?? contextFactory())->start($script, $cancellation));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Amp\Parallel\Worker;
|
||||
namespace Amp\Parallel\Worker\Internal;
|
||||
|
||||
use Amp\Cancellation;
|
||||
use Amp\CancelledException;
|
||||
@ -10,6 +10,11 @@ use Amp\ForbidSerialization;
|
||||
use Amp\Future;
|
||||
use Amp\Parallel\Context\Context;
|
||||
use Amp\Parallel\Context\StatusError;
|
||||
use Amp\Parallel\Worker\Execution;
|
||||
use Amp\Parallel\Worker\Internal;
|
||||
use Amp\Parallel\Worker\Task;
|
||||
use Amp\Parallel\Worker\Worker;
|
||||
use Amp\Parallel\Worker\WorkerException;
|
||||
use Amp\Pipeline\Queue;
|
||||
use Amp\Sync\ChannelException;
|
||||
use Amp\TimeoutCancellation;
|
||||
@ -17,9 +22,11 @@ use Revolt\EventLoop;
|
||||
use function Amp\async;
|
||||
|
||||
/**
|
||||
* Default worker implementation executing {@see Task}s.
|
||||
* Context based worker implementation executing {@see Task}s.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class DefaultWorker implements Worker
|
||||
final class ContextWorker implements Worker
|
||||
{
|
||||
use ForbidCloning;
|
||||
use ForbidSerialization;
|
Loading…
x
Reference in New Issue
Block a user