about summary refs log tree commit homepage
path: root/lib/rainbows/base.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-28 19:42:53 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-29 12:35:44 -0800
commit37a560c5d14c15a3da7f2c10c9ea3d6002b34fe1 (patch)
tree8d163646e4ba3586cafde788804c580e3315431c /lib/rainbows/base.rb
parent50fb5151bd44137adace51a0652f4d01d851790c (diff)
downloadrainbows-37a560c5d14c15a3da7f2c10c9ea3d6002b34fe1.tar.gz
It's a tad faster for non-keepalive connections and should do
better on large SMP machines with many workers AND threads.
That means the ActorSpawn model in Rubinius is nothing more than
ThreadSpawn underneath (for now).
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r--lib/rainbows/base.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index 4be37f4..7ee5c03 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -70,15 +70,11 @@ module Rainbows
     end
 
     def join_threads(threads)
-      G.quit!
       expire = Time.now + (timeout * 2.0)
-      until (threads.delete_if { |thr| ! thr.alive? }).empty?
-        threads.each { |thr|
-          G.tick
-          thr.join(1)
-          break if Time.now >= expire
-        }
+      until threads.empty? || Time.now >= expire
+        threads.delete_if { |thr| thr.alive? ? thr.join(0.01) : true }
       end
+      exit!(0) unless threads.empty?
     end
 
     def self.included(klass)