• PHP Video Tutorials

PHP - Threaded::isWaiting() Function



Threaded::isWaiting - State Detection.

Syntax

public boolean Threaded::isWaiting( void )

Threaded::isWaiting function can tell if a referenced object is waiting for the notification.

Threaded::isWaiting function doesn't have any parameters and can return a boolean indication of state.

Example

<?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);
?>
php_function_reference.htm
Advertisements