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/thread_pool.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/rainbows/thread_pool.rb') diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index 28a943e..a643bd8 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -24,6 +24,7 @@ module Rainbows module ThreadPool include Base + include Rainbows::Acceptor def worker_loop(worker) # :nodoc: init_worker_process(worker) @@ -44,7 +45,7 @@ module Rainbows def sync_worker # :nodoc: s = LISTENERS[0] begin - c = Rainbows.sync_accept(s) and process_client(c) + c = sync_accept(s) and process_client(c) rescue => e Error.listen_loop(e) end while G.alive @@ -58,7 +59,7 @@ module Rainbows # problem. On the other hand, a thundering herd may not # even incur as much overhead as an extra Mutex#synchronize ret = IO.select(LISTENERS, nil, nil, 1) and ret[0].each do |s| - s = Rainbows.accept(s) and process_client(s) + s = accept(s) and process_client(s) end rescue Errno::EINTR rescue => e -- cgit v1.2.3-24-ge0c7