The Thread class

(PECL pthreads >= 2.0.0)

Introduction

When the start method of a Thread is invoked, the run method code will be executed in separate Thread, in parallel.

After the run method is executed the Thread will exit immediately, it will be joined with the creating Thread at the appropriate time.

Warning

Relying on the engine to determine when a Thread should join may cause undesirable behaviour; the programmer should be explicit, where possible.

Class synopsis

Thread extends Threaded implements Countable , Traversable , ArrayAccess {
/* Methods */
public detach ( void ) : void
public getCreatorId ( void ) : int
public static getCurrentThread ( void ) : Thread
public static getCurrentThreadId ( void ) : int
public getThreadId ( void ) : int
public static globally ( void ) : mixed
public isJoined ( void ) : bool
public isStarted ( void ) : bool
public join ( void ) : bool
public kill ( void ) : void
public start ([ int $options ] ) : bool
/* Inherited methods */
public Threaded::chunk ( int $size , bool $preserve ) : array
public Threaded::count ( void ) : int
public Threaded::extend ( string $class ) : bool
public Threaded::from ( Closure $run [, Closure $construct [, array $args ]] ) : Threaded
public Threaded::getTerminationInfo ( void ) : array
public Threaded::isRunning ( void ) : bool
public Threaded::isTerminated ( void ) : bool
public Threaded::isWaiting ( void ) : bool
public Threaded::lock ( void ) : bool
public Threaded::merge ( mixed $from [, bool $overwrite ] ) : bool
public Threaded::notify ( void ) : bool
public Threaded::notifyOne ( void ) : bool
public Threaded::pop ( void ) : bool
public Threaded::run ( void ) : void
public Threaded::shift ( void ) : mixed
public Threaded::synchronized ( Closure $block [, mixed $... ] ) : mixed
public Threaded::unlock ( void ) : bool
public Threaded::wait ([ int $timeout ] ) : bool
}

Table of Contents