Threaded::getTerminationInfo

(PECL pthreads < 3.0.0)

Threaded::getTerminationInfoError Detection

Uyarı

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).

Açıklama

public Threaded::getTerminationInfo ( ) : array

Retrieves terminal error information from the referenced object

Değiştirgeler

Bu işlevin değiştirgesi yoktur.

Dönen Değerler

array containing the termination conditions of the referenced object

Örnekler

Örnek 1 Detecting fatal errors in Threads

<?php
class My extends Thread {
    public function 
run() {
        @
not_found();
    }
}

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

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

Yukarıdaki örneğin çıktısı:

bool(true)
array(4) {
  ["scope"]=>
  string(2) "My"
  ["function"]=>
  string(3) "run"
  ["file"]=>
  string(29) "/usr/src/pthreads/sandbox.php"
  ["line"]=>
  int(4)
}

add a note add a note

User Contributed Notes

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