public function testIteration() { $i = 0; $mutex = new CASMutex(); $mutex->synchronized(function () use($mutex, &$i) { $i++; if ($i > 1) { $mutex->notify(); } }); $this->assertEquals(2, $i); }