BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
ScopedLock Class Reference

Public Member Functions

 __destruct ()
 

Static Public Member Functions

static factory (LockManager $manager, array $paths, $type, Status $status, $timeout=0)
 
static release (ScopedLock &$lock=null)
 

Protected Member Functions

 __construct (LockManager $manager, array $pathsByType, Status $status)
 

Protected Attributes

 $manager
 
 $status
 
 $pathsByType
 

Detailed Description

Self-releasing locks

LockManager helper class to handle scoped locks, which release when an object is destroyed or goes out of scope.

Since
1.19

Constructor & Destructor Documentation

ScopedLock::__construct ( LockManager  $manager,
array  $pathsByType,
Status  $status 
)
protected
Parameters
LockManager$manager
array$pathsByTypeMap of lock types to path lists
Status$status
ScopedLock::__destruct ( )

Release the locks when this goes out of scope

Member Function Documentation

static ScopedLock::factory ( LockManager  $manager,
array  $paths,
  $type,
Status  $status,
  $timeout = 0 
)
static

Get a ScopedLock object representing a lock on resource paths. Any locks are released once this object goes out of scope. The status object is updated with any errors or warnings.

Parameters
LockManager$manager
array$pathsList of storage paths or map of lock types to path lists
int | string$typeLockManager::LOCK_* constant or "mixed" and $paths can be a map of types to paths (since 1.22). Otherwise $type should be an integer and $paths should be a list of paths.
Status$status
int$timeoutTimeout in seconds (0 means non-blocking) (since 1.22)
Returns
ScopedLock|null Returns null on failure
static ScopedLock::release ( ScopedLock $lock = null)
static

Release a scoped lock and set any errors in the attatched Status object. This is useful for early release of locks before function scope is destroyed. This is the same as setting the lock object to null.

Parameters
ScopedLock$lock
Since
1.21

The documentation for this class was generated from the following file: