Class: Bio::MAF::ForkRunner
- Inherits:
-
Object
- Object
- Bio::MAF::ForkRunner
- Defined in:
- lib/bio/maf/jobs.rb
Instance Method Summary collapse
- #add(&proc) ⇒ Object
-
#initialize(n_parallel) ⇒ ForkRunner
constructor
A new instance of ForkRunner.
- #run ⇒ Object
Constructor Details
#initialize(n_parallel) ⇒ ForkRunner
Returns a new instance of ForkRunner.
18 19 20 21 22 |
# File 'lib/bio/maf/jobs.rb', line 18 def initialize(n_parallel) @n_parallel = n_parallel @jobs = [] @kids = Set.new end |
Instance Method Details
#add(&proc) ⇒ Object
24 25 26 |
# File 'lib/bio/maf/jobs.rb', line 24 def add(&proc) @jobs << proc end |
#run ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/bio/maf/jobs.rb', line 28 def run until @jobs.empty? && @kids.empty? while can_start? start_job end await end end |