lib/asynchro/tracker.rb
# Performs an action. The supplied block will be called with a callback
# tracking Proc that should be triggered with `call` as many times as
# are specified in the `count` argument. When the correct number of calls
# have been made, this action is considered finished.
Performs an action. The supplied block will be called with a callback
tracking Proc that should be triggered with `call` as many times as
are specified in the `count` argument. When the correct number of calls
have been made, this action is considered finished.
Performs an action . The supplied block will be called with a callback tracking Proc that should be triggered with ` call ` as many times as are specified in the ` count ` argument . When the correct number of calls have been made this action is considered finished .
def perform(count = 1, *args)
    @operations ||= { }
    _sequence = @sequence += 1
    @operations[_sequence] = true
    fiber = Fiber.new do
      called = false
      should_resume = false
      callback = lambda {
        called = true
        if (should_resume)
          fiber.resume
        end
      }
      count.times do
        called = false
        yield(callback, *args)
        unless (called)
          should_resume = true
          Fiber.yield
        end
      end
      @operations.delete(_sequence)
      if (self.finished?)
        self.finish!
      end
    end
    (@fibers ||= [ ]) << fiber
  end
def perform ( count = 1 , * args ) @operations ||= { } _sequence = @sequence += 1 @operations [ _sequence ] = true fiber = Fiber . new do called = false should_resume = false callback = lambda { called = true if ( should_resume ) fiber . resume end } count . times do called = false yield ( callback , * args ) unless ( called ) should_resume = true Fiber . yield end end @operations . delete ( _sequence ) if ( self . finished? ) self . finish! end end ( @fibers ||= [ ] ) << fiber end
Performs an action.
Performs an action .
count
<not_specific>
args
<not_specific>