You are here

function background_process_start_locked in Background Process 7.2

Same name and namespace in other branches
  1. 8 background_process.module \background_process_start_locked()
  2. 6 background_process.module \background_process_start_locked()
  3. 7 background_process.module \background_process_start_locked()

Start locked background process

Calls the service handler through http passing function arguments as serialized data Be aware that the callback will run in a new request

@global string $base_url Base URL for this Drupal request

Parameters

$handle: Handle to give background process

$callback: Function to call

$var [, $... ]]: Arbitrary number of variables to pass on to the callback

Return value

mixed Handle on success, FALSE on failure

File

./background_process.module, line 726

Code

function background_process_start_locked($handle, $callback) {
  $args = func_get_args();
  $handle = array_shift($args);
  $callback = array_shift($args);
  return BackgroundProcess::lock($handle)
    ->setCallback($callback, $args)
    ->dispatch()
    ->getHandle();
}