diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-05 10:44:52 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-05 11:13:43 +0000 |
commit | 90a86c9822238f01e8d60c9303b9a0da64351c7f (patch) | |
tree | b13a4384b526887c964f74b1b9e2a2927e5b86bd /lib/rainbows/xepoll | |
parent | c9ca82c76f1eb0e06b0aa204a243d00f382579c5 (diff) | |
download | rainbows-90a86c9822238f01e8d60c9303b9a0da64351c7f.tar.gz |
acceptor thread pools could use some work, still
Diffstat (limited to 'lib/rainbows/xepoll')
-rw-r--r-- | lib/rainbows/xepoll/client.rb | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/rainbows/xepoll/client.rb b/lib/rainbows/xepoll/client.rb index 2db684e..da0a0d1 100644 --- a/lib/rainbows/xepoll/client.rb +++ b/lib/rainbows/xepoll/client.rb @@ -2,12 +2,12 @@ # :enddoc: module Rainbows::XEpoll::Client + N = Raindrops.new(1) + Rainbows::Epoll.nr_clients = lambda { N[0] } include Rainbows::Epoll::Client MAX = Rainbows.server.worker_connections THRESH = MAX - 1 EP = Rainbows::Epoll::EP - N = Raindrops.new(1) - @timeout = Rainbows.server.timeout / 2.0 THREADS = Rainbows::HttpServer::LISTENERS.map do |sock| Thread.new(sock) do |sock| sleep @@ -25,24 +25,8 @@ module Rainbows::XEpoll::Client def self.run THREADS.each { |t| t.run } - begin - EP.wait(nil, @timeout) { |flags, obj| obj.epoll_run } - Rainbows::Epoll.rerun - Rainbows::Epoll::Client.expire - rescue Errno::EINTR - rescue => e - Rainbows::Error.listen_loop(e) - end while Rainbows.tick - - THREADS.delete_if do |thr| - Rainbows.tick - begin - thr.run - thr.join(0.01) - rescue - true - end - end until THREADS.empty? + Rainbows::Epoll.loop + Rainbows::JoinThreads.acceptors(THREADS) end # only call this once |