You are here

function _background_process_ensure_cleanup in Background Process 8

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

Implements to Ensure lock is removed at end of request.

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

File

./background_process.module, line 1279
This module implements a framework for calling funtions in the background.

Code

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