Thread 類

(PECL pthreads >= 2.0.0)

簡介

當調(diào)用 Thread 對象的 start 方法時,該對象的 run 方法中的代碼將在獨立線程中并行執(zhí)行。

run 方法中的代碼執(zhí)行完畢之后,獨立線程立即退出,并且等待合適的時機由創(chuàng)建者線程加入(join)。

警告

依賴于引擎本身的機制檢測何時加入線程可能引發(fā)非預(yù)期的行為,程序員應(yīng)該盡可能的顯式控制線程加入的時機。

類摘要

class Thread extends Threaded implements Countable, Traversable, ArrayAccess {
/* 方法 */
public getCreatorId(): int
public static getCurrentThread(): Thread
public static getCurrentThreadId(): int
public getThreadId(): int
publicisJoined(): bool
publicisStarted(): bool
publicjoin(): bool
public start(int $options = ?): bool
/* 繼承的方法 */
public Threaded::chunk(int $size, bool $preserve): array
public Threaded::count(): int
public Threaded::extend(string $class): bool
public Threaded::isRunning(): bool
public Threaded::isTerminated(): bool
publicThreaded::merge(mixed $from, bool $overwrite = ?): bool
public Threaded::notify(): bool
public Threaded::notifyOne(): bool
public Threaded::pop(): bool
public Threaded::run(): void
public Threaded::shift(): boolean
public Threaded::synchronized(Closure $block, mixed $... = ?): mixed
public Threaded::wait(int $timeout = ?): bool
}

目錄