def try_update
      old_value = get
      new_value = yield old_value
      unless compare_and_set(old_value, new_value)
        raise ConcurrentUpdateError, "Update failed"
      end
      new_value
    end
def try_update
      old_value = get
      new_value = yield old_value
      unless compare_and_set(old_value, new_value)
        raise ConcurrentUpdateError, "Update failed"
      end
      new_value
    end
Pass the current value to the given block, replacing it with the block's
 result. Raise an exception if the update fails.

 @yield [Object]
   Calculate a new value for the atomic reference using given (old) value.
 @yieldparam [Object] old_value
   The starting value of the atomic reference.

 @raise [Garcon::ConcurrentUpdateError]
   If the update fails

 @return [Object] the new value