From ad821f70a2488a91f2be1ac53cb2e64f50743989 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Sep 2010 17:40:01 -0700 Subject: start using kgio library It removes the burden of byte slicing and setting file descriptor flags. In some cases, we can remove unnecessary peeraddr calls, too. --- lib/rainbows/thread_pool.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/rainbows/thread_pool.rb') diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index a643bd8..321d3e4 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -22,9 +22,7 @@ module Rainbows # others and thus a lower +worker_connections+ setting is recommended. module ThreadPool - include Base - include Rainbows::Acceptor def worker_loop(worker) # :nodoc: init_worker_process(worker) @@ -45,7 +43,7 @@ module Rainbows def sync_worker # :nodoc: s = LISTENERS[0] begin - c = sync_accept(s) and process_client(c) + c = s.kgio_accept and process_client(c) rescue => e Error.listen_loop(e) end while G.alive @@ -59,7 +57,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 = accept(s) and process_client(s) + s = s.kgio_tryaccept and process_client(s) end rescue Errno::EINTR rescue => e -- cgit v1.2.3-24-ge0c7