Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

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);

Drupal 8

$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 LockBackendInterface::getLockId().

Impacts: 
Module developers