• PHP Video Tutorials

PHP - Threaded::isRunning() Function



Threaded::isRunning - State Detection.

Syntax

public boolean Threaded::isRunning( void )

Threaded::isRunning function can tell if a referenced object is executing.

Threaded::isRunning 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(!$thread->done)
               $thread->wait();
         }, $this);
      }
   }
   $my = new My();
   $my->start();
   var_dump($my->isRunning());
   $my->synchronized(function($thread) {
      $thread->done = true;
      $thread->notify();
   }, $my);
?>
php_function_reference.htm
Advertisements