class Concurrent::Promises::Event

cancellation.
pending or resolved. It should be always resolved. Use {Future} to communicate rejections and
Represents an event which will happen in future (will be resolved). The event is either

def any(event_or_future)

Returns:
  • (Event) -
def any(event_or_future)
  AnyResolvedEventPromise.new_blocked_by2(self, event_or_future, @DefaultExecutor).event
end

def callback_on_resolution(state, args, callback)

def callback_on_resolution(state, args, callback)
  callback.call(*args)
end

def delay

Returns:
  • (Event) -
def delay
  event = DelayPromise.new(@DefaultExecutor).event
  ZipEventEventPromise.new_blocked_by2(self, event, @DefaultExecutor).event
end

def rejected_resolution(raise_on_reassign, state)

def rejected_resolution(raise_on_reassign, state)
  raise Concurrent::MultipleAssignmentError.new('Event can be resolved only once') if raise_on_reassign
  return false
end

def schedule(intended_time)

Returns:
  • (Event) -
def schedule(intended_time)
  chain do
    event = ScheduledPromise.new(@DefaultExecutor, intended_time).event
    ZipEventEventPromise.new_blocked_by2(self, event, @DefaultExecutor).event
  end.flat_event
end

def to_event

Returns:
  • (Event) -
def to_event
  self
end

def to_future

Returns:
  • (Future) -
def to_future
  future = Promises.resolvable_future
ensure
  chain_resolvable(future)
end

def with_default_executor(executor)

Returns:
  • (Event) -
def with_default_executor(executor)
  EventWrapperPromise.new_blocked_by1(self, executor).event
end

def zip(other)

Returns:
  • (Future, Event) -
def zip(other)
  if other.is_a?(Future)
    ZipFutureEventPromise.new_blocked_by2(other, self, @DefaultExecutor).future
  else
    ZipEventEventPromise.new_blocked_by2(self, other, @DefaultExecutor).event
  end
end