public function synchronized(callable $code) { $this->lock(); try { return call_user_func($code); } finally { $this->unlock(); } }