PHP Class Icicle\Concurrent\Forking\Fork

Inheritance: implements Icicle\Concurrent\Sync\ChannelInterface, implements Icicle\Concurrent\ProcessInterface
显示文件 Open project: icicleio/concurrent Class Usage Examples

Public Methods

Method Description
__clone ( )
__construct ( callable $function, $args )
__destruct ( )
enabled ( ) : boolean Checks if forking is enabled.
getPid ( ) : integer Gets the forked process's process ID.
getPriority ( ) : float Gets the fork's scheduling priority as a percentage.
isRunning ( ) : boolean Checks if the context is running.
join ( ) : Generator
kill ( )
receive ( ) : Generator
send ( $data ) : Generator
setPriority ( float $priority ) : float Sets the fork's scheduling priority as a percentage.
signal ( integer $signo )
spawn ( callable $function, $args ) : self Spawns a new forked process and runs it.
start ( ) Starts the context execution.

Private Methods

Method Description
execute ( Channel $channel ) : Generator

Method Details

__clone() public method

public __clone ( )

__construct() public method

public __construct ( callable $function, $args )
$function callable

__destruct() public method

public __destruct ( )

enabled() public static method

Checks if forking is enabled.
public static enabled ( ) : boolean
return boolean True if forking is enabled, otherwise false.

getPid() public method

Gets the forked process's process ID.
public getPid ( ) : integer
return integer The process ID.

getPriority() public method

The priority is a float between 0 and 1 that indicates the relative priority for the forked process, where 0 is very low priority, 1 is very high priority, and 0.5 is considered a "normal" priority. The value is based on the forked process's "nice" value. The priority affects the operating system's scheduling of processes. How much the priority actually affects the amount of CPU time the process gets is ultimately system-specific.
See also: Fork::setPriority()
See also: http://linux.die.net/man/2/getpriority
public getPriority ( ) : float
return float A priority value between 0 and 1.

isRunning() public method

Checks if the context is running.
public isRunning ( ) : boolean
return boolean True if the context is running, otherwise false.

join() public method

public join ( ) : Generator
return Generator

kill() public method

public kill ( )

receive() public method

public receive ( ) : Generator
return Generator

send() public method

public send ( $data ) : Generator
return Generator

setPriority() public method

Note that on many systems, only the superuser can increase the priority of a process.
See also: Fork::getPriority()
public setPriority ( float $priority ) : float
$priority float A priority value between 0 and 1.
return float

signal() public method

public signal ( integer $signo )
$signo integer

spawn() public static method

Spawns a new forked process and runs it.
public static spawn ( callable $function, $args ) : self
$function callable A callable to invoke in the process.
return self The process object that was spawned.

start() public method

Starts the context execution.
public start ( )