pthreads - PHP thread - run method not being called -
for reason run method not being called? ideas i'm going wrong?
<?php class workerthread extends thread { private $i = 0; public function __construct( $i ) { $this->i = $i; } public function run() { $a = 0; while( $a < 100 ) { file_put_contents( "test" . $this->i . ".txt", $a, file_append ); sleep( 5 ); } } } $workers = array(); ( $i = 0; $i < 3; $i++ ) { $workers[ $i ] = new workerthread( $i ); $workers[ $i ]->start(); } ?>
in while loop, $a
never changes , causes infinite loop (it's equal zero).
Comments
Post a Comment