Thread::isJoined

(PECL pthreads >= 2.0.0)

Thread::isJoinedDétection de statut

Description

public function Thread::isJoined(): bool

Indique si le Thread référencé a été joint.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Cette fonction retourne true en cas de succès ou false si une erreur survient.

Exemples

Exemple #1 Détecte le statut du Thread référencé

<?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);
?>

L'exemple ci-dessus va afficher :

bool(false)