(PECL pthreads >= 2.0.0)
Threaded::wait — Synchronization
$timeout = ?): bool让发起调用的线程上下文进入等待状态,直到收到其他线程的唤醒通知
timeout可选参数,等待时间,以微秒计
   成功时返回 true, 或者在失败时返回 false。
  
示例 #1 等待和唤醒
<?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());
?>
以上例程会输出:
bool(true)