Threaded::notify

(PECL pthreads >= 2.0.0)

Threaded::notifySynchronisation

Description

publicThreaded::notify(): bool

Envoi une notification à l'objet référencé

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 Notifications et attente

<?php
class My extends Thread {
public function
run() {

$this->synchronized(function($thread){
if (!
$thread->done)
$thread->wait();
},
$this);
}
}
$my = new My();
$my->start();

$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
},
$my);
var_dump($my->join());
?>

L'exemple ci-dessus va afficher :

bool(true)
To Top