PHP 8.3.4 Released!

Thread::isStarted

(PECL pthreads >= 2.0.0)

Thread::isStarted状態を検出する

説明

public Thread::isStarted(): bool

このスレッドが開始したかどうかを調べます。

パラメータ

この関数にはパラメータはありません。

戻り値

成功した場合に true を、失敗した場合に false を返します。

例1 スレッドが開始したかどうかを検出する

<?php
$worker
= new Worker();
$worker->start();
var_dump($worker->isStarted());
?>

上の例の出力は以下となります。

bool(true)

add a note

User Contributed Notes 1 note

up
4
ricardo dot boss at web dot de
7 years ago
Even if you kill() a thread, the isStarted() method will still return true.
To Top