pthread Thread objects reset their state
问题 Working recently with the extension pthreads, i discovered an anomaly. I have a simple object with an internal state: class Sum { private $value = 0; public function add($inc) { $this->value += $inc; } public function getValue() { return $this->value; } } Now i created a Thread class that does something with this object: class MyThread extends Thread { private $sum; public function __construct(Sum $sum) { $this->sum = $sum; } public function run(){ for ($i=0; $i < 10; $i++) { $this->sum->add