1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/lib/Context/functions.php

34 lines
497 B
PHP
Raw Normal View History

<?php
namespace Amp\Parallel\Context;
use Amp\Promise;
/**
* @param string|string[] $script
*
* @return Context
*/
function create($script): Context
{
if (Parallel::isSupported()) {
return new Parallel($script);
}
return new Process($script);
}
/**
* @param string|string[] $script
*
* @return Promise<Context>
*/
function run($script): Promise
{
if (Parallel::isSupported()) {
return Parallel::run($script);
}
return Process::run($script);
}