From 6bde32081338ce8075854f4c47ce8ca5347df919 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Jan 2011 17:06:20 -0800 Subject: eliminate G constant and just use the Rainbows! module Code organization is hard :< --- lib/rainbows/thread_pool.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/rainbows/thread_pool.rb') 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) -- cgit v1.2.3-24-ge0c7