Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal.php \Drupal::lock()
  2. 9 core/lib/Drupal.php \Drupal::lock()

Returns the locking layer instance.

Return value

\Drupal\Core\Lock\LockBackendInterface

Related topics

10 calls to Drupal::lock()
Comment::preSave in core/modules/comment/src/Entity/Comment.php
Acts on an entity before the presave hook is invoked.
Comment::releaseThreadLock in core/modules/comment/src/Entity/Comment.php
Release the lock acquired for the thread in preSave().
DrupalTest::testLock in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the lock() method.
RegistryTest::testMultipleSubThemes in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests the theme registry with multiple subthemes.
RegistryTest::testRaceCondition in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests the behavior of the theme registry class.

... See full list

File

core/lib/Drupal.php, line 391

Class

Drupal
Static Service Container wrapper.

Code

public static function lock() {
  return static::getContainer()
    ->get('lock');
}