La classe Thread

(PECL pthreads >= 2.0.0)

Introduction

Quand la méthode start d'un Thread est appelée, le code de la méthode run sera exécuté de façon parallèle dans un Thread séparé.

Après l'exécution de la méthode run, le Thread se terminera immédiatement, il sera rattaché au Thread d'origine par la suite.

Avertissement

S'appuyer sur le moteur pour déterminer quand un Thread sera rattaché peut provoquer un comportement non désiré. Le développeur doit être explicite tant que possible.

Synopsis de la classe

class Thread extends Threaded implements Countable, Traversable, ArrayAccess {
/* Méthodes */
public function getCreatorId(): int
public static function getCurrentThread(): Thread
public static function getCurrentThreadId(): int
public function getThreadId(): int
public function isJoined(): bool
public function isStarted(): bool
public function join(): bool
public function start(int $options = ?): bool
/* Méthodes héritées */
public function Threaded::chunk(int $size, bool $preserve): array
public function Threaded::count(): int
public function Threaded::extend(string $class): bool
public function Threaded::isRunning(): bool
public function Threaded::isTerminated(): bool
public function Threaded::merge(mixed $from, bool $overwrite = ?): bool
public function Threaded::notify(): bool
public function Threaded::notifyOne(): bool
public function Threaded::pop(): bool
public function Threaded::run(): void
public function Threaded::shift(): mixed
public function Threaded::synchronized(Closure $block, mixed ...$args): mixed
public function Threaded::wait(int $timeout = ?): bool
}

Sommaire