PHP Class Icicle\Concurrent\Threading\Thread

The thread context is not itself threaded. A local instance of the context is maintained both in the context that creates the thread and in the thread itself.
Inheritance: implements Icicle\Concurrent\Strand
Show file Open project: icicleio/concurrent Class Usage Examples

Public Methods

Method Description
__clone ( ) Returns the thread to the condition before starting. The new thread can be started and run independently of the first thread.
__construct ( callable $function, $args ) Creates a new thread.
__destruct ( ) Kills the thread if it is still running.
enabled ( ) : boolean Checks if threading is enabled.
isRunning ( ) : boolean Checks if the context is running.
join ( ) : Generator
kill ( ) Immediately kills the context.
receive ( ) : Generator
send ( $data ) : Generator
spawn ( callable $function, $args ) : Thread Spawns a new thread and runs it.
start ( ) Spawns the thread and begins the thread's execution.

Private Methods

Method Description
close ( ) Closes channel and socket if still open.

Method Details

__clone() public method

Returns the thread to the condition before starting. The new thread can be started and run independently of the first thread.
public __clone ( )

__construct() public method

Creates a new thread.
public __construct ( callable $function, $args )
$function callable The callable to invoke in the thread when run.

__destruct() public method

Kills the thread if it is still running.
public __destruct ( )

enabled() public static method

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

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

Immediately kills the context.
public kill ( )

receive() public method

public receive ( ) : Generator
return Generator

send() public method

public send ( $data ) : Generator
return Generator

spawn() public static method

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

start() public method

Spawns the thread and begins the thread's execution.
public start ( )