Class: IOPromise::ExecutorPool::Sequential

Inherits:
Base
  • Object
show all
Defined in:
lib/iopromise/executor_pool/sequential.rb

Instance Method Summary collapse

Methods inherited from Base

#begin_executing, #complete, for, #initialize, #register, #sync

Constructor Details

This class inherits a constructor from IOPromise::ExecutorPool::Base

Instance Method Details

#execute_continue(ready_readers, ready_writers, ready_exceptions) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/iopromise/executor_pool/sequential.rb', line 10

def execute_continue(ready_readers, ready_writers, ready_exceptions)
  @pending.dup.each do |active|
    status = if active.fulfilled?
      nil
    else
      execute_continue_item(active, ready_readers, ready_writers, ready_exceptions)
    end
    
    unless status.nil?
      # once we're waiting on our one next item, we're done
      return status
    else
      # we're done with this one, so remove it
      complete(active)
    end
  end
    
  # if we fall through to here, we have nothing to wait on.
  [[], [], [], nil]
end

#execute_continue_item(item, ready_readers, ready_writers, ready_exceptions) ⇒ Object



6
7
8
# File 'lib/iopromise/executor_pool/sequential.rb', line 6

def execute_continue_item(item, ready_readers, ready_writers, ready_exceptions)
  item.execute_continue(ready_readers, ready_writers, ready_exceptions)
end