PHP 8.4.0 RC2 available for testing

Threaded::isTerminated

(PECL pthreads >= 2.0.0)

Threaded::isTerminated状态检测

说明

public Threaded::isTerminated(): bool

检测是否因致命错误或未捕获的异常而导致执行过程异常终止

参数

此函数没有参数。

返回值

布尔值,表示是否异常终止

示例

示例 #1 检测对象状态

<?php
class My extends Thread {
public function
run() {
i_do_not_exist();
}
}
$my = new My();
$my->start();
$my->join();
var_dump($my->isTerminated());
?>

以上示例会输出:

bool(true)

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top