diff options
Diffstat (limited to 'lib/rainbows')
-rw-r--r-- | lib/rainbows/base.rb | 9 | ||||
-rw-r--r-- | lib/rainbows/revactor.rb | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb index 3336c3b..424b43b 100644 --- a/lib/rainbows/base.rb +++ b/lib/rainbows/base.rb @@ -70,10 +70,11 @@ module Rainbows end def join_threads(threads) - expire = Time.now + (timeout * 2.0) - until threads.empty? || Time.now >= expire - threads.delete_if { |thr| thr.alive? ? thr.join(0.01) : true } - end + G.quit! + threads.delete_if do |thr| + G.tick + thr.alive? ? thr.join(0.01) : true + end until threads.empty? end def self.included(klass) diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb index 125e148..b647d48 100644 --- a/lib/rainbows/revactor.rb +++ b/lib/rainbows/revactor.rb @@ -116,9 +116,7 @@ module Rainbows end end - Actor.sleep 1 while G.tick - expire = Time.now + timeout * 2.0 - Actor.sleep 1 while nr > 0 && Time.now < expire + Actor.sleep 1 while G.tick || nr > 0 rescue Errno::EMFILE => e end |