linux - Enable Thread Safety for Php Version 5.6.2 -
i have below php version installed in linux server.
now want run below program -
<?php class asyncoperation extends thread { public function __construct($arg) { $this->arg = $arg; } public function run() { if ($this->arg) { $sleep = mt_rand(1, 10); printf('%s: %s -start -sleeps %d' . "\n", date("g:i:sa"), $this->arg, $sleep); sleep($sleep); printf('%s: %s -finish' . "\n", date("g:i:sa"), $this->arg); } } } // create array $stack = array(); //iniciate miltiple thread foreach ( range("a", "d") $i ) { $stack[] = new asyncoperation($i); } // start threads foreach ( $stack $t ) { $t->start(); } ?>
i need enable thread safety php installation. can inform me how can ?
ok, i asked package maintainer:
if want use threaded version of php, on own. while might work fine in specific environment, it's not thread-safe in possible scenarios (including loading external modules) , it's not wise provide "thread-safe" packages general use.
so, no way out :-/
Comments
Post a Comment