(PECL pthreads >= 2.0.0)
Threaded::notify — Sincronização
Esta função não possui parâmetros.
Exemplo #1 Notificações e espera
<?php
class My extends Thread {
public function run() {
/** faz com que este thread espere **/
$this->synchronized(function($thread){
if (!$thread->done)
$thread->wait();
}, $this);
}
}
$my = new My();
$my->start();
/** envia notificação para o thread em espera **/
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
}, $my);
var_dump($my->join());
?>
O exemplo acima produzirá:
bool(true)