2019-01-16 16:22:02 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-16 17:28:52 +01:00
|
|
|
namespace JoopSchilder\Asynchronous;
|
|
|
|
|
2019-01-16 16:22:02 +01:00
|
|
|
|
|
|
|
if (!function_exists('async_run')) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param callable $function
|
|
|
|
* @param mixed ...$parameters
|
|
|
|
* @return Promise|null
|
|
|
|
*/
|
|
|
|
function async(callable $function, ...$parameters)
|
|
|
|
{
|
|
|
|
return Asynchronous::run($function, ...$parameters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('async_cleanup')) {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function async_cleanup()
|
|
|
|
{
|
|
|
|
Asynchronous::cleanup();
|
|
|
|
}
|
|
|
|
}
|
2019-01-16 16:53:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('async_await_all')) {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function async_await_all()
|
|
|
|
{
|
|
|
|
Asynchronous::awaitChildren();
|
|
|
|
}
|
|
|
|
}
|