PHP - Fonctions de thread

La classe Thread

Chaque fois qu'une méthode de démarrage de la classe Thread est appelée, le code de la méthode d'exécution peut être exécuté parallèlement dans un thread distinct.

Synopsis du cours

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. Non Description de la fonction
1

Thread :: detach ()

La fonction peut détacher un Thread référencé du contexte appelant, dangereux!

2

Thread :: getCreatorId ()

Function peut renvoyer une identité de Thread qui a créé un Thread référencé.

3

Thread :: getCurrentThread ()

La fonction peut renvoyer une référence au Thread en cours d'exécution.

4

Thread :: getCurrentThreadId ()

La fonction peut renvoyer l'identité du Thread en cours d'exécution.

5

Thread :: getThreadId ()

La fonction peut renvoyer une identité de Thread référencé.

6

Thread :: globalement ()

La fonction peut exécuter Callable dans une portée globale.

sept

Thread :: isJoined

La fonction peut dire si le thread référencé a été joint.

8

Thread :: isStarted ()

La fonction peut dire si un thread référencé a été démarré.

9

Thread :: join ()

La fonction peut amener le contexte appelant à attendre la fin de l'exécution d'un thread référencé.

dix

Discussion :: kill ()

La fonction peut forcer un thread référencé à se terminer.

11

Thread :: start ()

Function peut démarrer un nouveau thread pour exécuter une méthode d'exécution implémentée.