From 47e1ee2d90161abf92ce14562bf508398fdfa6c9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Aug 2010 13:58:11 -0700 Subject: split out accept() callers to acceptor module Trying to avoid adding singleton methods since it's too easily accessible by the public and not needed by the general public. This also allows us (or just Zbatery) to more easily add support systems without FD_CLOEXEC or fcntl, and also to optimize away a fcntl call for systems that inherit FD_CLOEXEC. --- lib/rainbows/fiber_spawn.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rainbows/fiber_spawn.rb') diff --git a/lib/rainbows/fiber_spawn.rb b/lib/rainbows/fiber_spawn.rb index df72e70..ecf83d8 100644 --- a/lib/rainbows/fiber_spawn.rb +++ b/lib/rainbows/fiber_spawn.rb @@ -12,6 +12,7 @@ module Rainbows module FiberSpawn include Fiber::Base + include Rainbows::Acceptor def worker_loop(worker) # :nodoc: init_worker_process(worker) @@ -22,7 +23,7 @@ module Rainbows begin schedule do |l| break if G.cur >= limit - io = Rainbows.accept(l) or next + io = accept(l) or next ::Fiber.new { process_client(fio.new(io, ::Fiber.current)) }.resume end rescue => e -- cgit v1.2.3-24-ge0c7