(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)