Made the code more robust.

Extended functionality with helper functions.
This commit is contained in:
Joop Schilder
2019-01-16 16:22:02 +01:00
parent 1466c2eaef
commit c0cfaadcc3
8 changed files with 372 additions and 93 deletions

29
src/functions.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace Joop\Asynchronous;
require_once __DIR__ . '/../vendor/autoload.php';
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();
}
}