diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-05 17:06:20 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-06 07:17:19 +0000 |
commit | 6bde32081338ce8075854f4c47ce8ca5347df919 (patch) | |
tree | 71759032be458838eb33f7951172e8572aec4b6d /lib/rainbows/thread_spawn.rb | |
parent | d6e4975937a9590f48dc39b1a4aefa9d62f34616 (diff) | |
download | rainbows-6bde32081338ce8075854f4c47ce8ca5347df919.tar.gz |
Code organization is hard :<
Diffstat (limited to 'lib/rainbows/thread_spawn.rb')
-rw-r--r-- | lib/rainbows/thread_spawn.rb | 10 |
1 files changed, 5 insertions, 5 deletions
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: |