首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Threaded::getTerminationInfo

(PECL pthreads < 3.0.0)

Threaded::getTerminationInfo — Error Detection

Warning

This method has been removed in pthreads v3. Instead, the body of Threaded::run() can be wrapped in a try...catch block to detect errors (since most errors in PHP 7 have been converted to exceptions).

Description

代码语言:javascript
复制
public array Threaded::getTerminationInfo ( void )

Retrieves terminal error information from the referenced object

Parameters

This function has no parameters.

Return Values

array containing the termination conditions of the referenced object

Examples

Example #1 Detecting fatal errors in Threads

代码语言:javascript
复制
<?php
class My extends Thread {
    public function run() {
        @not_found();
    }
}

$my = new My();
$my->start();
$my->join();

var_dump($my->isTerminated(), $my->getTerminationInfo());
?>

The above example will output:

代码语言:javascript
复制
bool(true)
array(4) {
  ["scope"]=>
  string(2) "My"
  ["function"]=>
  string(3) "run"
  ["file"]=>
  string(29) "/usr/src/pthreads/sandbox.php"
  ["line"]=>
  int(4)
}

← Threaded::from

Threaded::isRunning →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券