@abstract @!visibility private
# File lib/concurrent/edge/future.rb, line 990 def initialize(future, blocked_by_futures, countdown) initialize_blocked_by(blocked_by_futures) @Countdown = AtomicFixnum.new countdown super(future) @BlockedBy.each { |f| f.add_callback :pr_callback_notify_blocked, self } end
!visibility private for inspection only
# File lib/concurrent/edge/future.rb, line 1017 def blocked_by @BlockedBy end
# File lib/concurrent/edge/future.rb, line 1021 def inspect "#{to_s[0..-2]} blocked_by:[#{ blocked_by.map(&:to_s).join(', ')}]>" end
@api private
# File lib/concurrent/edge/future.rb, line 999 def on_done(future) countdown = process_on_done(future) completable = completable?(countdown) if completable on_completable(future) # futures could be deleted from blocked_by one by one here, but that would be too expensive, # it's done once when all are done to free the reference clear_blocked_by! end end
# File lib/concurrent/edge/future.rb, line 1011 def touch blocked_by.each(&:touch) end
# File lib/concurrent/edge/future.rb, line 1031 def clear_blocked_by! # not synchronized because we do not care when this change propagates @BlockedBy = [] nil end
@return [true,false] if completable
# File lib/concurrent/edge/future.rb, line 1038 def completable?(countdown) countdown.zero? end
# File lib/concurrent/edge/future.rb, line 1027 def initialize_blocked_by(blocked_by_futures) @BlockedBy = [blocked_by_futures].flatten end
# File lib/concurrent/edge/future.rb, line 1046 def on_completable(done_future) raise NotImplementedError end
# File lib/concurrent/edge/future.rb, line 1042 def process_on_done(future) @Countdown.decrement end