PHP Class XPSPL\Idle

The idle class is used for idling the processor, the base provides no functionality in itself and must be extended. What it does provide is a base for writing an idle object, with this it gives the default functions of setting the maximum of itself allowed per loop, the priority of the idling function and allow override of the same idle. The base provides the rules that only one type of the given idle function should exist and a default priority of zero for all.
Mostra file Open project: prggmr/xpspl

Protected Properties

Property Type Description
$_allow_override boolean When set to true the "override" method will be called otherwise the processor will signal a Idle_Function_Overflow.
$_priority integer Priority of this idle function. Zero comes first

Public Methods

Method Description
allow_override ( ) : boolean Return if this function allows itself to be overwritten in the limit is met or exceeded.
get_priority ( ) : integer Returns the priority of this idle function.
idle ( Processor $processor ) : void Idle's the processor.
override ( object $idle ) : boolean Returns if the given function can override this in the processor.

Method Details

allow_override() final public method

Return if this function allows itself to be overwritten in the limit is met or exceeded.
final public allow_override ( ) : boolean
return boolean

get_priority() final public method

Returns the priority of this idle function.
final public get_priority ( ) : integer
return integer

idle() public method

This function is purely responsible for providing the processor the ability to idle. This method is provided an instance of the processor which is wishing to idle and should respect the processors current specifications for the amount of time that it needs to idle if it knows. You have been warned ... Creating a function that does not properly idle, does not respect the processor specs or is poorly designed will result in terrible performance, unexpected results and can be damaging to your system ... use caution.
public idle ( Processor $processor ) : void
$processor Processor \XPSPL\Processor
return void

override() public method

Returns if the given function can override this in the processor.
public override ( object $idle ) : boolean
$idle object Idle function object
return boolean

Property Details

$_allow_override protected_oe property

When set to true the "override" method will be called otherwise the processor will signal a Idle_Function_Overflow.
protected bool $_allow_override
return boolean

$_priority protected_oe property

Priority of this idle function. Zero comes first
protected int $_priority
return integer