Documentation

NoSemaphore extends Semaphore
in package

No Semaphore Class

Disables the semaphore! Just pass it to the Workerpool setSemaphore method before creating the pool. Attention: You will lose the possibility to synchronize worker processes

Table of Contents

Constants

SEM_FTOK_KEY  = 'ftok'
generate a key based on ftok
SEM_MAX_INT  = 2147483647
maximum semaphore int
SEM_MIN_INT  = -2147483647
minimum semaphore int
SEM_RAND_KEY  = 'rand'
generate a random key

Properties

$semaphore  : resource|SysvSemaphore
$semKey  : int

Methods

acquire()  : Semaphore
Acquire the semaphore
create()  : Semaphore
Create a semaphore
destroy()  : Semaphore
Destroys the semaphore
getSemaphoreKey()  : int
Returns the key, that can be used to access the semaphore
isCreated()  : bool
Has the semaphore been created?
release()  : Semaphore
Releases the semaphore
synchronize()  : Semaphore
Run something synchronized
synchronizedBegin()  : Semaphore
Acquire the semaphore
synchronizedEnd()  : Semaphore
Releases the semaphore

Constants

SEM_FTOK_KEY

generate a key based on ftok

public mixed SEM_FTOK_KEY = 'ftok'

SEM_MAX_INT

maximum semaphore int

public mixed SEM_MAX_INT = 2147483647

SEM_MIN_INT

minimum semaphore int

public mixed SEM_MIN_INT = -2147483647

SEM_RAND_KEY

generate a random key

public mixed SEM_RAND_KEY = 'rand'

Properties

$semaphore

protected resource|SysvSemaphore $semaphore = NULL

the semaphore resource

$semKey

protected int $semKey = NULL

the key that is used to access the semaphore

Methods

create()

Create a semaphore

public create([string|int $semKey = Semaphore::SEM_FTOK_KEY ][, int $maxAcquire = 1 ][, int $perms = 0666 ]) : Semaphore
Parameters
$semKey : string|int = Semaphore::SEM_FTOK_KEY

the key of the semaphore - use a specific number or Semaphore::SEM_RAND_KEY or Semaphore::SEM_FTOK_KEY

$maxAcquire : int = 1

the maximum number of processes, that can acquire the semaphore

$perms : int = 0666

the unix permissions for (user,group,others) - valid range from 0 to 0777

Tags
throws
SemaphoreException
Return values
Semaphore

the current object

getSemaphoreKey()

Returns the key, that can be used to access the semaphore

public getSemaphoreKey() : int
Return values
int

the key of the semaphore

isCreated()

Has the semaphore been created?

public isCreated() : bool
Return values
bool

true in case the semaphore has been created

synchronize()

Run something synchronized

public synchronize(Closure $closure) : Semaphore
Parameters
$closure : Closure

the closure, that should be run synchronized

Tags
throws
SemaphoreException

in case of an error

Return values
Semaphore

the current object


        
On this page

Search results