Add brackets, update README, refactored naming
This commit is contained in:
40
lib/functions.php
Normal file
40
lib/functions.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
use JoopSchilder\Asynchronous\Asynchronous;
|
||||
use JoopSchilder\Asynchronous\Promise;
|
||||
|
||||
if (!function_exists('async')) {
|
||||
|
||||
/**
|
||||
* @param callable $function
|
||||
* @param mixed ...$parameters
|
||||
* @return Promise
|
||||
*/
|
||||
function async(callable $function, ...$parameters)
|
||||
{
|
||||
return Asynchronous::run($function, ...$parameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('async_cleanup')) {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function async_cleanup()
|
||||
{
|
||||
Asynchronous::cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('async_wait_all')) {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function async_wait_all()
|
||||
{
|
||||
Asynchronous::waitForChildren();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user