You are here

function httprl_lock_release in HTTP Parallel Request & Threading Library 6

Same name and namespace in other branches
  1. 7 httprl.module \httprl_lock_release()

Release a lock previously acquired by lock_acquire().

This will release the named lock.

Parameters

string $name: The name of the lock.

2 calls to httprl_lock_release()
httprl_async_page in ./httprl.async.inc
Menu Callback; run given function.
httprl_call_user_func_array_cache in ./httprl.module
Cache a function; regenerate return value in the background.
1 string reference to 'httprl_lock_release'
httprl_install_http_test in ./httprl.install
Issue a HTTP request to admin/httprl-test, verifying that the server got it.

File

./httprl.module, line 2716
HTTP Parallel Request Library module.

Code

function httprl_lock_release($name) {
  $lock_inc = httprl_variable_get('lock_inc', './includes/lock.inc');

  // Core.
  if ($lock_inc === './includes/lock.inc') {
    unset($GLOBALS['locks'][$name]);
    if (defined('VERSION') && substr(VERSION, 0, 1) >= 7) {
      db_delete('semaphore')
        ->condition('name', $name)
        ->execute();
    }
    else {
      db_query("DELETE FROM {semaphore} WHERE name = '%s'", $name);
    }
  }
  elseif (strpos($lock_inc, '/memcache_storage/includes/lock.inc') !== FALSE) {

    // We unset unconditionally since caller assumes lock is released anyway.
    unset($GLOBALS['locks'][$name]);

    // Remove current lock from memcached pool.
    if (MemcacheStorageAPI::get($name, 'semaphore')) {
      MemcacheStorageAPI::delete($name, 'semaphore');
    }
  }
  elseif (strpos($lock_inc, '/memcache/memcache-lock.inc') !== FALSE) {

    // We unset unconditionally since caller assumes lock is released anyway.
    unset($GLOBALS['locks'][$name]);
    if (dmemcache_get($name, 'semaphore')) {
      dmemcache_delete($name, 'semaphore');
    }
  }
  elseif (strpos($lock_inc, '/apdqc/apdqc.lock.inc') !== FALSE) {
    lock_release_fuzzy($name);
  }
  else {
    lock_release($name);
  }
}