Method: Thread::Pool#process
- Defined in:
- lib/storyboard/thread-util.rb
#process(*args, &block) ⇒ Object Also known as: <<
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/storyboard/thread-util.rb', line 125 def process (*args, &block) unless block || @block raise ArgumentError, 'you must pass a block' end task = Task.new(self, *args, &(block || @block)) @mutex.synchronize { raise 'unable to add work while shutting down' if shutdown? @todo << task if @waiting == 0 && @spawned < @max spawn_thread end @cond.signal } task end |