Assign the method result to a variable $result, release the lock, return $result.