28 protected function doLock( array $paths, $type ) {
29 foreach ( $paths as
$path ) {
30 if ( isset( $this->locksHeld[
$path][$type] ) ) {
31 ++$this->locksHeld[
$path][$type];
33 $this->locksHeld[
$path][$type] = 1;
37 return StatusValue::newGood();
40 protected function doUnlock( array $paths, $type ) {
41 $status = StatusValue::newGood();
43 foreach ( $paths as
$path ) {
44 if ( isset( $this->locksHeld[
$path][$type] ) ) {
45 if ( --$this->locksHeld[
$path][$type] <= 0 ) {
46 unset( $this->locksHeld[
$path][$type] );
47 if ( !$this->locksHeld[
$path] ) {
48 unset( $this->locksHeld[
$path] );
52 $status->warning(
'lockmanager-notlocked',
$path );
Resource locking handling.
Simple lock management based on in-process reference counting.
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.