mirror of
https://github.com/amphp/parallel.git
synced 2025-07-18 12:01:24 +02:00
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
29 lines
810 B
PHP
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);
|
|
}
|
|
}
|