# The Thread class

(PECL pthreads >= 2.0.0)

## Introducere

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.

Avertizare

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

## Sinopsisul clasei

Thread extends Threaded implements Countable , Traversable , ArrayAccess {
/* Metode */
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
/* Metode moștenite */
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
}

## Cuprins

- Thread::detach — Execution
- Thread::getCreatorId — Identification
- Thread::getCurrentThread — Identification
- Thread::getCurrentThreadId — Identification
- Thread::getThreadId — Identification
- Thread::globally — Execution
- Thread::isJoined — State Detection
- Thread::isStarted — State Detection
- Thread::join — Synchronization
- Thread::kill — Execution
- Thread::start — Execution