You are here

function _background_process_ensure_cleanup in Background Process 7

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

Ensure lock is removed at end of request.

Parameters

string $handle: Handle of background process

bool $remove: If TRUE, don't remove when shutting down

3 calls to _background_process_ensure_cleanup()
BackgroundProcess::dispatch in ./BackgroundProcess.class.php
BackgroundProcess::queue in ./BackgroundProcess.class.php
background_process_lock_process in ./background_process.module
Lock process.

File

./background_process.module, line 1482

Code

function _background_process_ensure_cleanup($handle, $remove = FALSE) {
  $handles =& drupal_static('background_process_handles_locked', NULL);
  if (!isset($handles)) {
    $handles = array();
    drupal_register_shutdown_function('_background_process_cleanup_locks');
  }
  if ($remove) {
    unset($handles[$handle]);
  }
  else {
    $handles[$handle] = $handle;
  }
}