PHP Class Threaded, ClearSky

Threaded objects form the basis of pthreads ability to execute user code asynchronously; they expose and include synchronization methods and various useful interfaces. Threaded objects, most importantly, provide implicit safety for the programmer; all operations on the object scope are safe.
Inheritance: implements Traversable, implements Collectable
Datei anzeigen Open project: robske110/ClearSky Class Usage Examples

Public Methods

Method Description
addRef ( )
chunk ( integer $size, boolean $preserve = false ) : array Fetches a chunk of the objects properties table of the given size
count ( )
delRef ( )
extend ( object $obj )
getRefCount ( ) : integer
isGarbage ( ) : boolean
isRunning ( ) : boolean Tell if the referenced object is executing
isTerminated ( ) : boolean Tell if the referenced object exited, suffered fatal errors, or threw uncaught exceptions during execution
merge ( mixed $from, boolean $overwrite = true ) : boolean Merges data into the current object
notify ( ) : boolean Send notification to the referenced object
notifyOne ( )
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
pop ( ) : mixed Pops an item from the objects property table
run ( ) : void The programmer should always implement the run method for objects that are intended for execution.
shift ( ) : mixed Shifts an item from the objects properties table
synchronized ( Closure $function, mixed $args = null ) : mixed Executes the block while retaining the synchronization lock for the current context.
wait ( integer $timeout ) : boolean Waits for notification from the Stackable

Method Details

addRef() public method

public addRef ( )

chunk() public method

Fetches a chunk of the objects properties table of the given size
public chunk ( integer $size, boolean $preserve = false ) : array
$size integer The number of items to fetch
$preserve boolean default false
return array An array of items from the objects member table

count() public method

public count ( )

delRef() public method

public delRef ( )

extend() public static method

public static extend ( object $obj )
$obj object

getRefCount() public method

public getRefCount ( ) : integer
return integer

isGarbage() public method

public isGarbage ( ) : boolean
return boolean

isRunning() public method

Tell if the referenced object is executing
public isRunning ( ) : boolean
return boolean A boolean indication of state

isTerminated() public method

Tell if the referenced object exited, suffered fatal errors, or threw uncaught exceptions during execution
public isTerminated ( ) : boolean
return boolean A boolean indication of state

merge() public method

Merges data into the current object
public merge ( mixed $from, boolean $overwrite = true ) : boolean
$from mixed The data to merge
$overwrite boolean Overwrite existing keys flag, by default true
return boolean A boolean indication of success

notify() public method

Send notification to the referenced object
public notify ( ) : boolean
return boolean A boolean indication of success

notifyOne() public method

public notifyOne ( )

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

pop() public method

Pops an item from the objects property table
public pop ( ) : mixed
return mixed The last item from the objects properties table

run() public method

The programmer should always implement the run method for objects that are intended for execution.
public run ( ) : void
return void The methods return value, if used, will be ignored

shift() public method

Shifts an item from the objects properties table
public shift ( ) : mixed
return mixed The first item from the objects properties table

synchronized() public method

Executes the block while retaining the synchronization lock for the current context.
public synchronized ( Closure $function, mixed $args = null ) : mixed
$function Closure The block of code to execute
$args mixed ... Variable length list of arguments to use as function arguments to the block
return mixed The return value from the block

wait() public method

Waits for notification from the Stackable
public wait ( integer $timeout ) : boolean
$timeout integer An optional timeout in microseconds
return boolean A boolean indication of success