You are here

public static function BackgroundProcess::dispatchAll in Background Process 7.2

Dispatch multiple prepared processes

Parameters

array &$processes: BackgroundProcess objects - dispatched processes will be removed from the array

Return value

array Dispatched BackgroundProcess objects

File

./background_process.inc, line 710
External API short overview

Class

BackgroundProcess
@file

Code

public static function dispatchAll(&$processes) {
  $dispatched = array();
  foreach ($processes as $idx => $process) {
    try {
      $process
        ->dispatch();
      $dispatched[] = $process;
      unset($processes[$idx]);
    } catch (BackgroundProcessException $e) {

      // Skip to the next.
      $process->last_error = $e;
    }
  }
  return $dispatched;
}