diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-09-28 17:40:01 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-09-28 17:40:01 -0700 |
commit | ad821f70a2488a91f2be1ac53cb2e64f50743989 (patch) | |
tree | 6db4d334106360305ba3b66b643e8694f232fa10 /lib/rainbows/thread_pool.rb | |
parent | 11c75ec06ce72cea0c760161dc01a196500aa293 (diff) | |
download | rainbows-ad821f70a2488a91f2be1ac53cb2e64f50743989.tar.gz |
It removes the burden of byte slicing and setting file descriptor flags. In some cases, we can remove unnecessary peeraddr calls, too.
Diffstat (limited to 'lib/rainbows/thread_pool.rb')
-rw-r--r-- | lib/rainbows/thread_pool.rb | 6 |
1 files changed, 2 insertions, 4 deletions
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 |