about summary refs log tree commit homepage
path: root/lib/rainbows/fiber/coolio
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/fiber/coolio
parentd6e4975937a9590f48dc39b1a4aefa9d62f34616 (diff)
downloadrainbows-6bde32081338ce8075854f4c47ce8ca5347df919.tar.gz
Code organization is hard :<
Diffstat (limited to 'lib/rainbows/fiber/coolio')
-rw-r--r--lib/rainbows/fiber/coolio/heartbeat.rb4
-rw-r--r--lib/rainbows/fiber/coolio/server.rb8
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/rainbows/fiber/coolio/heartbeat.rb b/lib/rainbows/fiber/coolio/heartbeat.rb
index f48f7ef..6b1e4f9 100644
--- a/lib/rainbows/fiber/coolio/heartbeat.rb
+++ b/lib/rainbows/fiber/coolio/heartbeat.rb
@@ -1,12 +1,10 @@
 # -*- encoding: binary -*-
 # :enddoc:
 class Rainbows::Fiber::Coolio::Heartbeat < Coolio::TimerWatcher
-  G = Rainbows::G
-
   # ZZ gets populated by read_expire in rainbows/fiber/io/methods
   ZZ = Rainbows::Fiber::ZZ
   def on_timer
-    exit if (! G.tick && G.cur <= 0)
+    exit if (! Rainbows.tick && Rainbows.cur <= 0)
     now = Time.now
     fibs = []
     ZZ.delete_if { |fib, time| now >= time ? fibs << fib : ! fib.alive? }
diff --git a/lib/rainbows/fiber/coolio/server.rb b/lib/rainbows/fiber/coolio/server.rb
index b064953..3d8d85e 100644
--- a/lib/rainbows/fiber/coolio/server.rb
+++ b/lib/rainbows/fiber/coolio/server.rb
@@ -1,8 +1,6 @@
 # -*- encoding: binary -*-
 # :enddoc:
 class Rainbows::Fiber::Coolio::Server < Coolio::IOWatcher
-  G = Rainbows::G
-
   def to_io
     @io
   end
@@ -18,14 +16,14 @@ class Rainbows::Fiber::Coolio::Server < Coolio::IOWatcher
   end
 
   def on_readable
-    return if G.cur >= MAX
+    return if Rainbows.cur >= MAX
     c = @io.kgio_tryaccept and Fiber.new { process(c) }.resume
   end
 
   def process(io)
-    G.cur += 1
+    Rainbows.cur += 1
     io.process_loop
   ensure
-    G.cur -= 1
+    Rainbows.cur -= 1
   end
 end