Stud.IP  5.4
StudipLock Class Reference

Static Public Member Functions

static getCurrent ()
 
static get ($lockname, $timeout=10)
 
static isFree ($lockname)
 
static release ()
 
static lockname ($lockname)
 

Member Function Documentation

◆ get()

static get (   $lockname,
  $timeout = 10 
)
static

Tries to obtain a lock with a name given by the string $lockname, using a timeout of $timeout seconds. Returns 1 if the lock was obtained successfully, 0 if the attempt timed out (for example, because another client has previously locked the name), or NULL if an error occurred If a name has been locked by one client, any request by another client for a lock with the same name is blocked.

Parameters
string$lockname
number$timeoutin seconds
Exceptions
UnexpectedValueExceptionif there is already an active lock
Returns
integer 1 if the lock was obtained successfully, 0 if the attempt timed out

◆ getCurrent()

static getCurrent ( )
static

returns the name of the current active lock

Returns
string name of active lock

◆ isFree()

static isFree (   $lockname)
static

check if lock with given name is available

Parameters
string$lockname
Returns
integer 1 if lock is available

◆ lockname()

static lockname (   $lockname)
static

prepends the name of current database to lockname because locks are server-wide

Parameters
string$lockname
Returns
string

◆ release()

static release ( )
static

release the current lock

Returns
integer 1 if the lock could be released

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