Class: Workpile::Parent
- Inherits:
-
Object
- Object
- Workpile::Parent
- Defined in:
- lib/workpile.rb
Instance Method Summary collapse
- #abort ⇒ Object
-
#initialize ⇒ Parent
constructor
A new instance of Parent.
- #kill_working_children ⇒ Object
- #request(obj) ⇒ Object
- #spawn_children(n, cmd) ⇒ Object
Constructor Details
Instance Method Details
#abort ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/workpile.rb', line 74 def abort @abort = true @threads.each do |th| if not th.join(5) @service.kill_boot_children end end end |
#kill_working_children ⇒ Object
70 71 72 |
# File 'lib/workpile.rb', line 70 def kill_working_children @service.kill_working_children end |
#request(obj) ⇒ Object
56 57 58 |
# File 'lib/workpile.rb', line 56 def request(obj) @service.push obj end |
#spawn_children(n, cmd) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/workpile.rb', line 60 def spawn_children(n, cmd) n.times.map do |index| @threads << Thread.new do while !@abort system("#{cmd} #{DRb.uri} #{index}") end end end end |