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_spawn.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/rainbows/thread_spawn.rb') diff --git a/lib/rainbows/thread_spawn.rb b/lib/rainbows/thread_spawn.rb index d2d41e8..a0520d1 100644 --- a/lib/rainbows/thread_spawn.rb +++ b/lib/rainbows/thread_spawn.rb @@ -25,24 +25,24 @@ module Rainbows::ThreadSpawn LISTENERS.each do |l| klass.new(l) do |l| begin - if lock.synchronize { G.cur >= limit } + if lock.synchronize { Rainbows.cur >= limit } worker_yield elsif c = l.kgio_accept klass.new(c) do |c| begin - lock.synchronize { G.cur += 1 } + lock.synchronize { Rainbows.cur += 1 } c.process_loop ensure - lock.synchronize { G.cur -= 1 } + lock.synchronize { Rainbows.cur -= 1 } end end end rescue => e Rainbows::Error.listen_loop(e) - end while G.alive + end while Rainbows.alive end end - sleep 1 while G.tick || lock.synchronize { G.cur > 0 } + sleep 1 while Rainbows.tick || lock.synchronize { Rainbows.cur > 0 } end def worker_loop(worker) #:nodoc: -- cgit v1.2.3-24-ge0c7