You are here

function _background_process_ensure_cleanup in Background Process 6

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

Ensure lock is removed at end of request

Parameters

$handle: Handle of background process

$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 1354

Code

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