Files
parallel/test/Worker/ThreadPoolTest.php
Aaron Piotrowski 7f8ca5472d
Some checks are pending
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, on Windows, windows-latest, nts, 8.3) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, on macOS, macos-latest, nts, 8.3) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.1) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.2) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (false, ubuntu-latest, nts, 8.3) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (none, true, with ext-parallel, ubuntu-latest, parallel, ts, 8.2, none, none) (push) Waiting to run
Continuous Integration / PHP ${{ matrix.php-version }} ${{ matrix.job-description }} (none, true, with ext-parallel, ubuntu-latest, parallel, ts, 8.3, none, none) (push) Waiting to run
Add DelegatingWorkerPool
2024-09-01 09:40:09 -05:00

29 lines
810 B
PHP

<?php declare(strict_types=1);
namespace Amp\Parallel\Test\Worker;
use Amp\Parallel\Context\ThreadContext;
use Amp\Parallel\Context\ThreadContextFactory;
use Amp\Parallel\Worker\ContextWorkerFactory;
use Amp\Parallel\Worker\ContextWorkerPool;
use Amp\Parallel\Worker\WorkerPool;
class ThreadPoolTest extends AbstractPoolTest
{
protected function createPool(
int $max = WorkerPool::DEFAULT_WORKER_LIMIT,
?string $autoloadPath = null,
): WorkerPool {
if (!ThreadContext::isSupported()) {
$this->markTestSkipped('ext-parallel required');
}
$factory = new ContextWorkerFactory(
bootstrapPath: $autoloadPath,
contextFactory: new ThreadContextFactory(),
);
return new ContextWorkerPool($max, $factory);
}
}