There is now a
\Drupal::lock() function, which returns an instance of the locking layer.
Drupal 7 (these functions have been removed)
lock_acquire($name, $timeout); lock_wait($name, $delay); lock_release($name); lock_release_all($lock_id);
$lock = \Drupal::lock(); $lock->acquire($name, $timeout); $lock->wait($name, $delay); $lock->release($name); $lock->releaseAll($lock_id);
Additionally, the functionality in
_lock_id() has been moved to