PHP - Thread Functions
The Thread class
Whenever a start method of the Thread class invoked, the run method code can be executed in a separate thread parallelly.
Class synopsis
Thread extends Threaded implements Countable , Traversable , ArrayAccess {
/* Methods */
public void detach ( void )
public integer getCreatorId ( void )
public static Thread getCurrentThread ( void )
public static integer getCurrentThreadId ( void )
public integer getThreadId ( void )
public static mixed globally ( void )
public boolean isJoined ( void )
public boolean isStarted ( void )
public boolean join ( void )
public void kill ( void )
public boolean start ([ integer $options ] )
/* Inherited methods */
public array Threaded::chunk ( integer $size , boolean $preserve )
public integer Threaded::count ( void )
public bool Threaded::extend ( string $class )
public Threaded Threaded::from ( Closure $run [, Closure $construct [, array $args ]] )
public array Threaded::getTerminationInfo ( void )
public boolean Threaded::isRunning ( void )
public boolean Threaded::isTerminated ( void )
public boolean Threaded::isWaiting ( void )
public boolean Threaded::lock ( void )
public boolean Threaded::merge ( mixed $from [, bool $overwrite ] )
public boolean Threaded::notify ( void )
public boolean Threaded::notifyOne ( void )
public boolean Threaded::pop ( void )
public void Threaded::run ( void )
public mixed Threaded::shift ( void )
public mixed Threaded::synchronized ( Closure $block [, mixed $... ] )
public boolean Threaded::unlock ( void )
public boolean Threaded::wait ([ integer $timeout ] )
}
| Sr.No | Function & Description |
|---|---|
| 1 |
Function can detach a referenced Thread from the calling context, dangerous! |
| 2 |
Function can return an identity of Thread that created a referenced Thread. |
| 3 |
Function can return a reference to currently executing Thread. |
| 4 |
Function can return the identity of currently executing Thread. |
| 5 |
Function can return an identity of referenced Thread. |
| 6 |
Function can execute Callable in a global scope. |
| 7 |
Function can tell if the referenced Thread has been joined. |
| 8 |
Function can tell if a referenced Thread was started. |
| 9 |
Function can cause the calling context to wait for a referenced Thread to finish executing. |
| 10 |
Function can force a referenced Thread to terminate. |
| 11 |
Function can start a new thread to execute an implemented run method. |