php8.5
Home/ Manual/ pthreads / thread/ Thread::isJoined

Thread::isJoined

PHP function Edit on GitHub ✎

(PECL pthreads >= 2.0.0)

State Detection

Description

Thread::isJoined(): bool

Tell if the referenced Thread has been joined

Parameters Parameters

Return Values

Success

Examples

Detect the state of the referenced Thread

php
<?php
class My extends Thread {
    public function run() {
        $this->synchronized(function($thread){
            if (!$thread->done)
                $thread->wait();
        }, $this);
    }
}
$my = new My();
$my->start();
var_dump($my->isJoined());
$my->synchronized(function($thread){
    $thread->done = true;
    $thread->notify();
}, $my);
?>

The above example will output:

output
bool(false)

Source: reference/pthreads/thread/isjoined.xml · from the official PHP manual (php/doc-en)