|
| __construct ($key, $factory) |
| Construct a lock containing the unique key required to release it.
|
|
| get_key () |
| Return the unique key representing this lock.
|
|
| init_factory (lock_factory $factory) |
| Sets the lock factory that owns a lock.
|
|
| release () |
| Release this lock.
|
|
| release_if_not_released (bool $withexception=false) |
| Release a lock if it has not already been released.
|
|
|
string | $caller = 'unknown' |
| $caller Where was this called from?
|
|
lock_factory | $factory |
| $factory The factory that generated this lock
|
|
string int | $key = '' |
| $key A unique key representing a held lock
|
|
bool | $released |
| $released Has this lock been released?
|
|
- Copyright
- Damyon Wiese 2013
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core\lock\lock::__construct |
( |
| $key, |
|
|
| $factory ) |
Construct a lock containing the unique key required to release it.
- Parameters
-
mixed | $key | - The lock key. The type of this is up to the lock_factory being used. For file locks this is a file handle. For MySQL this is a string. |
lock_factory | $factory | - The factory that generated this lock. |
◆ get_key()
core\lock\lock::get_key |
( |
| ) |
|
Return the unique key representing this lock.
- Return values
-
◆ init_factory()
Sets the lock factory that owns a lock.
This function should not be called under normal use. It is intended only for cases like {
- See also
- timing_wrapper_lock_factory} where we wrap a lock factory.
When used, it should be called immediately after constructing the lock.
- Parameters
-
lock_factory | $factory | New lock factory that owns this lock |
◆ release()
core\lock\lock::release |
( |
| ) |
|
Release this lock.
- Return values
-
◆ release_if_not_released()
core\lock\lock::release_if_not_released |
( |
bool | $withexception = false | ) |
|
Release a lock if it has not already been released.
- Parameters
-
bool | $withexception | If true, throw an exception if the lock has not been released. |
- Exceptions
-
◆ $caller
string core\lock\lock::$caller = 'unknown' |
|
protected |
$caller Where was this called from?
Stored for when a warning is shown
◆ $released
bool core\lock\lock::$released |
|
protected |
$released Has this lock been released?
If a lock falls out of scope without being released - show a warning.
The documentation for this class was generated from the following file:
- lib/classes/lock/lock.php