1
0
mirror of https://github.com/danog/parallel.git synced 2025-01-22 14:01:14 +01:00

Kill worker forks

Forking for workers is just not a good idea… it's too likely to be used irresponsibly.
This commit is contained in:
Aaron Piotrowski 2017-03-16 17:33:30 -05:00
parent 7f592265d0
commit 0236fc5336
3 changed files with 0 additions and 54 deletions

View File

@ -1,19 +0,0 @@
<?php
namespace Amp\Parallel\Worker;
use Amp\Promise;
use Amp\Parallel\Forking\Fork;
use Amp\Parallel\Worker\Internal\TaskRunner;
/**
* 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();
}));
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace Amp\Parallel\Test\Worker;
use Amp\Parallel\Worker\{ DefaultPool, WorkerFactory, WorkerFork };
/**
* @group forking
* @requires extension pcntl
*/
class ForkPoolTest extends AbstractPoolTest {
protected function createPool($min = null, $max = null) {
$factory = $this->createMock(WorkerFactory::class);
$factory->method('create')->will($this->returnCallback(function () {
return new WorkerFork;
}));
return new DefaultPool($min, $max, $factory);
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace Amp\Parallel\Test\Worker;
use Amp\Parallel\Worker\WorkerFork;
/**
* @group forking
* @requires extension pcntl
*/
class WorkerForkTest extends AbstractWorkerTest {
protected function createWorker() {
return new WorkerFork;
}
}