lib/thread/pool.rb in thread-0.0.8 vs lib/thread/pool.rb in thread-0.0.8.1

- old
+ new

@@ -247,11 +247,15 @@ self end # Join on all threads in the pool. def join - @workers.first.join until @workers.empty? + until @workers.empty? + if worker = @workers.first + worker.join + end + end self end # Define a timeout for a task. @@ -302,12 +306,12 @@ break if shutdown? @waiting += 1 @cond.wait @mutex @waiting -= 1 + end - break !shutdown? - end or break + break if @todo.empty? && shutdown? end @todo.shift } or break