• PHP Video Tutorials

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

Thread::detach()

Function can detach a referenced Thread from the calling context, dangerous!

2

Thread::getCreatorId()

Function can return an identity of Thread that created a referenced Thread.

3

Thread::getCurrentThread()

Function can return a reference to currently executing Thread.

4

Thread::getCurrentThreadId()

Function can return the identity of currently executing Thread.

5

Thread::getThreadId()

Function can return an identity of referenced Thread.

6

Thread::globally()

Function can execute Callable in a global scope.

7

Thread::isJoined

Function can tell if the referenced Thread has been joined.

8

Thread::isStarted()

Function can tell if a referenced Thread was started.

9

Thread::join()

Function can cause the calling context to wait for a referenced Thread to finish executing.

10

Thread::kill()

Function can force a referenced Thread to terminate.

11

Thread::start()

Function can start a new thread to execute an implemented run method.

php_function_reference.htm
Advertisements