• PHP Video Tutorials

PHP - Pool::shutdown() Function



Pool::shutdown() function can shutdown all the workers.

Syntax

public void Pool::shutdown( void )

Pool:: shutdown() function shut down all of the workers in a pool. It can block until all submitted tasks have been executed.

Pool:: shutdown() function has no parameters and doesn't return any value.

Example

<?php
   class Task extends Threaded {
      public function run() {
         usleep(500000);
      }
   }
   $pool = new Pool(4);

   for($i = 0; $i < 10; ++$i) {
      $pool>submit(new Task());
   }
   $pool->shutdown();
?>
php_function_reference.htm
Advertisements