(PECL pthreads >= 2.0.0)
Threaded::wait — Synchronization
$timeout
] ) : bool锟矫凤拷锟斤拷锟斤拷玫锟斤拷叱锟斤拷锟斤拷锟斤拷慕锟斤拷锟饺达拷状态锟斤拷直锟斤拷锟秸碉拷锟斤拷锟斤拷锟竭程的伙拷锟斤拷通知
timeout
锟斤拷选锟斤拷锟斤拷锟斤拷锟饺达拷时锟戒,锟斤拷微锟斤拷锟�
锟斤拷锟斤拷值锟斤拷锟斤拷示锟斤拷锟斤拷锟角凤拷晒锟�
Example #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)