©
                    本文档使用
                    php中文网手册 发布
                
(PECL pthreads >= 2.0.0)
Threaded::isWaiting — State Detection
检测对象是否在等待其他线程唤醒
此函数没有参数。
布尔值,表示是否处于等待唤醒状态
Example #1 检测对象状态
  <?php
 class  My  extends  Thread  {
    public function  run () {
         $this -> synchronized (function( $thread ){
            if (! $this -> done )
                 $thread -> wait ();
        },  $this );
    }
    
    protected  $done ;
}
 $my  = new  My ();
 $my -> start ();
 $my -> synchronized (function( $thread ){
     var_dump (
         $thread -> isWaiting ());
     $thread -> done  =  true ;
     $thread -> notify ();
},  $my );
 ?>   以上例程会输出:
bool(true)