You are here

function lock_release in Memcache Storage 7

Release a lock previously acquired by lock_acquire().

This will release the named lock if it is still held by the current request.

Parameters

$name: The name of the lock.

File

includes/lock.inc, line 152
A memcached based implementation of a locking mechanism. See includes/lock.inc for documentation.

Code

function lock_release($name) {
  global $locks;

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

  // Remove current lock from memcached pool.
  $lock = MemcacheStorageAPI::get($name, 'semaphore');
  if ($lock && $lock == _lock_id()) {
    MemcacheStorageAPI::delete($name, 'semaphore');
  }
}