class Concurrent::Edge::FlatPromise
@!visibility private
Public Class Methods
new(blocked_by_future, levels, default_executor)
click to toggle source
Calls superclass method
Concurrent::Edge::BlockedPromise.new
# File lib/concurrent/edge/future.rb, line 1196 def initialize(blocked_by_future, levels, default_executor) raise ArgumentError, 'levels has to be higher than 0' if levels < 1 super Future.new(self, default_executor), blocked_by_future, 1 + levels end
Public Instance Methods
blocked_by()
click to toggle source
!visibility private
# File lib/concurrent/edge/future.rb, line 1164 def blocked_by @BlockedBy.each.to_a end
Private Instance Methods
clear_blocked_by!()
click to toggle source
# File lib/concurrent/edge/future.rb, line 1209 def clear_blocked_by! @BlockedBy.clear nil end
completable?(countdown, future)
click to toggle source
Calls superclass method
Concurrent::Edge::BlockedPromise#completable?
# File lib/concurrent/edge/future.rb, line 1214 def completable?(countdown, future) !@Future.internal_state.completed? && super(countdown, future) end
initialize_blocked_by(blocked_by_future)
click to toggle source
# File lib/concurrent/edge/future.rb, line 1201 def initialize_blocked_by(blocked_by_future) @BlockedBy = LockFreeStack.new.push(blocked_by_future) end
on_completable(done_future)
click to toggle source
# File lib/concurrent/edge/future.rb, line 1205 def on_completable(done_future) complete_with done_future.internal_state end
process_on_done(future)
click to toggle source
Calls superclass method
Concurrent::Edge::BlockedPromise#process_on_done
# File lib/concurrent/edge/future.rb, line 1170 def process_on_done(future) countdown = super(future) if countdown.nonzero? internal_state = future.internal_state unless internal_state.success? complete_with internal_state return countdown end value = internal_state.value case value when Future value.touch if self.future.touched @BlockedBy.push value value.add_callback :callback_notify_blocked, self @Countdown.value when Event evaluate_to(lambda { raise TypeError, 'cannot flatten to Event' }) else evaluate_to(lambda { raise TypeError, "returned value #{value.inspect} is not a Future" }) end end countdown end