downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Modificateurs> <Stackable::unlock
[edit] Last updated: Fri, 17 May 2013

view this page in

Stackable::wait

(PECL pthreads >= 0.36)

Stackable::waitSynchronisation

Description

final public boolean Stackable::wait ([ string $timeout ] )

Attend une notification depuis le Stackable.

Liste de paramètres

timeout

Un délai d'attente maximal, optionnel, en millisecondes.

Valeurs de retour

Un booléen indiquant le succès de l'opération.

Exemples

Exemple #1 Notifications et Attente

<?php
class Work extends Stackable {
    public function 
run() {
        
$this->synchronized(function($object){
        
printf("%s synchronisé\n"__CLASS__);    
        
$object->notify();
        }, 
$this);
    }
}
class 
My extends Worker {
    public function 
run() {
        
/** ... **/
    
}
}

$my = new My();
$my->start();
$work = array(new Work());
$my->stack($work[0]);
/** Envoi une notification au thread en attente **/
$work[0]->synchronized(function($object){
    
printf("Process synchronisé\n");
    
$object->wait();
}, 
$work[0]);
?>

L'exemple ci-dessus va afficher :

Process synchronisé
Work synchronisé



add a note add a note User Contributed Notes Stackable::wait - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites