Stackable
PHP Manual

Stackable::isRunning

(PECL pthreads >= 0.36)

Stackable::isRunningDétection de statut

Description

final public boolean Stackable::isRunning ( void )

Un Stackable est en cours d'exécution lorsqu'un Thread Worker l'exécute.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Un booléen indiquant le statut de l'opération.

Exemples

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

<?php
class Work extends Stackable {
    public function 
run() {
        
$this->synchronized(function($object){
            
$object->wait();
        }, 
$this);
    }
}

class 
My extends Worker {
    public function 
run() {
        
/** ... **/
    
}
}

$my = new My();
$work = new Work();
$my->stack($work);
$my->start();
$work->synchronized(function($object){
        
$object->notify();
}, 
$work);
?>

L'exemple ci-dessus va afficher :

bool(true)


Stackable
PHP Manual