public function synchronize(callable $func, array $options = [])
    {
        $result = null;
        $exception = null;

        if ($this->acquire($options)) {
            try {
                $result = $func();
            } catch (\Exception $ex) {
                $exception = $ex;
            }
            $this->release();
        }

        if ($exception) {
            throw $exception;
        }

        return $result;
    }