You are here

function httprl_call_user_func_array_async in HTTP Parallel Request & Threading Library 6

Same name and namespace in other branches
  1. 7 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.

2 calls to httprl_call_user_func_array_async()
httprl.examples.php in examples/httprl.examples.php
HTTP Parallel Request Library code examples.
_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 3551
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();
  }
}