You are here

function httprl_qcinp in HTTP Parallel Request & Threading Library 7

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

Queue Callback to run In a New Process.

Parameters

callback: The callable to be called.

param_arr: The parameters to be passed to the callback, as an indexed array.

$return: Set to TRUE if you want something returned.

$httprl_options: Options to pass along to httprl_queue_background_callback.

Return value

Reference to the return variable OR NULL if $return is FALSE.

See also

call_user_func_array()

1 call to httprl_qcinp()
httprl_batch_callback in ./httprl.module
Given an array of data, use multiple processes to crunch it.

File

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

Code

function &httprl_qcinp($callback, $param_arr = array(), $return = TRUE, $httprl_options = array()) {
  $return_var = NULL;

  // Setup callback options array.
  $callback_options[0]['function'] = $callback;
  if ($return) {
    $return_var = '';
    $callback_options[0]['return'] =& $return_var;
  }
  if (isset($httprl_options['context'])) {
    $callback_options[0]['context'] = $httprl_options['context'];
    unset($httprl_options['context']);
  }
  $callback_options[0]['options'] = $httprl_options;

  // Include function arguments.
  $callback_options = array_merge($callback_options, $param_arr);

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