class Concurrent::IVar

def set(value = NULL)

Returns:
  • (IVar) - self

Raises:
  • (Concurrent::MultipleAssignmentError) - if the `IVar` has already
  • (ArgumentError) - if both a value and a block are given

Other tags:
    Yield: - A block operation to use for setting the value

Parameters:
  • value (Object) -- the value to store in the `IVar`
def set(value = NULL)
  check_for_block_or_value!(block_given?, value)
  raise MultipleAssignmentError unless compare_and_set_state(:processing, :pending)
  begin
    value = yield if block_given?
    complete_without_notification(true, value, nil)
  rescue => ex
    complete_without_notification(false, nil, ex)
  end
  notify_observers(self.value, reason)
  self
end