about summary refs log tree commit homepage
path: root/lib/rainbows/thread_pool.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 17:06:20 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-06 07:17:19 +0000
commit6bde32081338ce8075854f4c47ce8ca5347df919 (patch)
tree71759032be458838eb33f7951172e8572aec4b6d /lib/rainbows/thread_pool.rb
parentd6e4975937a9590f48dc39b1a4aefa9d62f34616 (diff)
downloadrainbows-6bde32081338ce8075854f4c47ce8ca5347df919.tar.gz
Code organization is hard :<
Diffstat (limited to 'lib/rainbows/thread_pool.rb')
-rw-r--r--lib/rainbows/thread_pool.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb
index c82e22a..3b8e68e 100644
--- a/lib/rainbows/thread_pool.rb
+++ b/lib/rainbows/thread_pool.rb
@@ -28,11 +28,11 @@ module Rainbows::ThreadPool
       Thread.new { LISTENERS.size == 1 ? sync_worker : async_worker }
     end
 
-    while G.alive
+    while Rainbows.alive
       # if any worker dies, something is serious wrong, bail
       pool.each do |thr|
-        G.tick or break
-        thr.join(1) and G.quit!
+        Rainbows.tick or break
+        thr.join(1) and Rainbows.quit!
       end
     end
     join_threads(pool)
@@ -44,7 +44,7 @@ module Rainbows::ThreadPool
       c = s.kgio_accept and c.process_loop
     rescue => e
       Rainbows::Error.listen_loop(e)
-    end while G.alive
+    end while Rainbows.alive
   end
 
   def async_worker # :nodoc:
@@ -60,13 +60,13 @@ module Rainbows::ThreadPool
     rescue Errno::EINTR
     rescue => e
       Rainbows::Error.listen_loop(e)
-    end while G.alive
+    end while Rainbows.alive
   end
 
   def join_threads(threads) # :nodoc:
-    G.quit!
+    Rainbows.quit!
     threads.delete_if do |thr|
-      G.tick
+      Rainbows.tick
       begin
         thr.run
         thr.join(0.01)