Commit | Line | Data |
---|---|---|
10760fa1 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
41498ac5 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
10760fa1 | 5 | | | |
41498ac5 TO |
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 | | |
10760fa1 TO |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | namespace Civi\Core\Lock; | |
12 | ||
e8e8f3ad | 13 | /** |
14 | * Lock interface. | |
15 | */ | |
10760fa1 TO |
16 | interface LockInterface { |
17 | ||
18 | /** | |
e8e8f3ad | 19 | * Acquire lock. |
20 | * | |
e97c66ff | 21 | * @param int|null $timeout |
10760fa1 TO |
22 | * The number of seconds to wait to get the lock. |
23 | * For a default value, use NULL. | |
24 | * @return bool | |
25 | */ | |
26 | public function acquire($timeout = NULL); | |
27 | ||
28 | /** | |
29 | * @return bool|null|string | |
30 | * Trueish/falsish. | |
31 | */ | |
32 | public function release(); | |
33 | ||
34 | /** | |
35 | * @return bool|null|string | |
36 | * Trueish/falsish. | |
37 | * @deprecated | |
38 | * Not supported by some locking strategies. If you need to poll, better | |
39 | * to use acquire(0). | |
40 | */ | |
41 | public function isFree(); | |
42 | ||
43 | /** | |
44 | * @return bool | |
45 | */ | |
46 | public function isAcquired(); | |
b7c4f29b | 47 | |
10760fa1 | 48 | } |