php pthreads: 'PHP Fatal error' , 'Fatal error' in CLI -


i ran example of https://github.com/krakjoe/pthreads/tree/seven/examplesin cli. after executing each one, php fatal error , fatal error ,in addition expected result. example in case https://github.com/krakjoe/pthreads/blob/seven/examples/closurefuture.php i'll get:

object(volatile)#6 (2) {  [0]=>      string(5) "hello"  [1]=>      string(5) "world"  }  array(2) {  [0]=>      string(5) "hello"  [1]=>      string(5) "world"  } 

php fatal error: cannot declare class future, because name in use in /var/www/test/index1.php on line 42

fatal error: cannot declare class future, because name in use in /var/www/test/index1.php on line 42

in example error occured when extended class closed.

do know reason of these errors , how correct them? appreciated.

class future extends thread {     private function __construct(closure $closure, array $args = []) {         $this->closure = $closure;         $this->args    = $args;      }     public function run() {         $this->synchronized(function() {             $this->result =                  ($this->closure)(...$this->args);             $this->notify();         });     }     public function getresult() {         return $this->synchronized(function(){             while (!$this->result)                 $this->wait();             return $this->result;         });     }      public static function of(closure $closure, array $args = []) {         $future =              new self($closure, $args);         $future->start();         return $future;     }      protected $owner;     protected $closure;     protected $args;     protected $result; }//line 42 

check server installed php version. according doc, supporting (php 5 >= 5.3.0).


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -