PHP Class Jenner\SimpleFork\Lock\Semaphore

Inheritance: implements Jenner\SimpleFork\Lock\LockInterface
Show file Open project: huyanping/simple-fork-php Class Usage Examples

Public Methods

Method Description
__destruct ( ) release lock
acquire ( boolean $blocking = true ) : boolean get a lock
create ( $key ) : Semaphore create a lock instance
isLocked ( ) : boolean is locked
release ( ) : boolean release lock

Protected Methods

Method Description
_stringToSemKey ( $identifier ) : integer Semaphore requires a numeric value as the key

Private Methods

Method Description
__construct ( $key, $count = 1 ) init a lock

Method Details

__destruct() public method

release lock
public __destruct ( )

_stringToSemKey() protected method

Semaphore requires a numeric value as the key
protected _stringToSemKey ( $identifier ) : integer
$identifier
return integer

acquire() public method

get a lock
public acquire ( boolean $blocking = true ) : boolean
$blocking boolean
return boolean

create() public static method

create a lock instance
public static create ( $key ) : Semaphore
$key
return Semaphore

isLocked() public method

is locked
public isLocked ( ) : boolean
return boolean

release() public method

release lock
public release ( ) : boolean
return boolean