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

classThreadextendsThreadedimplementsCountable, Traversable, ArrayAccess {
publicgetCreatorId(): int
publicstaticgetCurrentThread(): Thread
publicstaticgetCurrentThreadId(): int
publicgetThreadId(): int
publicisJoined(): bool
publicisStarted(): bool
publicjoin(): bool
publicstart(int$options = ?): bool
publicThreaded::chunk(int$size, bool$preserve): array
publicThreaded::merge(mixed$from, bool$overwrite = ?): bool
publicThreaded::synchronized(Closure$block, mixed...$args): mixed
publicThreaded::wait(int$timeout = ?): bool
}

Table of Contents

To Top