Threaded::isWaiting

(PECL pthreads < 3.0.0)

Threaded::isWaitingDétection de statut

Avertissement

Cette méthode a été supprimée dans pthreads v3.

Description

public Threaded::isWaiting ( void ) : bool

Indique si l'objet référencé est en attente d'une notification

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Un booléen indiquant le statut

Exemples

Exemple #1 Détecte le statut de l'objet référencé

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

L'exemple ci-dessus va afficher :

bool(true)