You are here

function httprl_call_user_func_array_async in HTTP Parallel Request & Threading Library 7

Same name and namespace in other branches
  1. 6 httprl.module \httprl_call_user_func_array_async()

Run the callback with the given params in the background.

Parameters

string $callback: The function to run

array $param_arr: The arguments to pass along to the function.

3 calls to httprl_call_user_func_array_async()
httprl.examples.php in examples/httprl.examples.php
HTTP Parallel Request Library code examples.
httprl_call_user_func_array_cache in ./httprl.module
Cache a function; regenerate return value in the background.
_httprl_run_functions_once_on_shutdown_array_cache in ./httprl.module
Cache function helper. Combine duplicates & run them in a shutdown function.

File

./httprl.module, line 3618
HTTP Parallel Request Library module.

Code

function httprl_call_user_func_array_async($callback, array $param_arr) {
  if (!httprl_is_background_callback_capable()) {
    call_user_func_array($callback, $param_arr);
  }
  else {

    // Setup callback options array; call $callback in the background.
    $callback_options = array_merge(array(
      array(
        'function' => $callback,
      ),
    ), $param_arr);

    // Queue up the request.
    httprl_queue_background_callback($callback_options);

    // Execute request.
    httprl_send_request();
  }
}