3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
11 namespace Civi\Core\Lock
;
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 class NullLock
implements LockInterface
{
20 private $hasLock = FALSE;
29 public static function create($name) {
36 * @param int|null $timeout
37 * The number of seconds to wait to get the lock.
38 * For a default value, use NULL.
42 public function acquire($timeout = NULL) {
43 $this->hasLock
= TRUE;
50 * @return bool|null|string
53 public function release() {
54 $this->hasLock
= FALSE;
59 * @return bool|null|string
62 * Not supported by some locking strategies. If you need to poll, better
65 public function isFree() {
66 return !$this->hasLock
;
72 public function isAcquired() {
73 return $this->hasLock
;