public function toTheStartingGate() { try { $this->atTheStartingGate->await(10000000); // 10 seks } catch (\Exception $e) { $this->reset(); throw $e; } }
public function f() { $this->barrier->await(); }
public function f() { $this->barrier->await(100, TimeUnit::MILLISECONDS()); }
public function testNormalUse() { $barrier = new CyclicBarrier(3); // name is just for debugging now $barrier->name = 'barrier'; $this->assertEquals($barrier->getParties(), 3); $awaiters = new AwaiterIterator($barrier, self::$atTheStartingGate); foreach (array(false, true) as $doReset) { for ($i = 0; $i < 4; $i++) { $a1 = $awaiters->next(); $a1->start(); $a2 = $awaiters->next(); $a2->start(); self::toTheStartingGate(); $barrier->await(); $a1->join(); $a2->join(); $this->checkResult($a1, null); $this->checkResult($a2, null); $this->assertFalse($barrier->isBroken()); $this->assertEquals($barrier->getParties(), 3); $this->assertEquals($barrier->getNumberWaiting(), 0); if ($doReset) { $this->reset($barrier); } } } }