diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-24 20:04:20 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-24 20:07:09 -0800 |
commit | 667b05819b85165061c445fb2c75ef161a5de5b6 (patch) | |
tree | af69ab3fe1f143c408c6c9013debf1c9afe26c72 /lib/rainbows/xaccept_epoll.rb | |
parent | 9f7f497dc21d904a1af20465318d85811daf0652 (diff) | |
download | rainbows-667b05819b85165061c445fb2c75ef161a5de5b6.tar.gz |
Edge-triggered epoll concurrency model with blocking accept() in a (hopefully) native thread. This is recommended over Epoll for Ruby 1.9 users as it can workaround accept()-scalability issues on multicore machines.
Diffstat (limited to 'lib/rainbows/xaccept_epoll.rb')
-rw-r--r-- | lib/rainbows/xaccept_epoll.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/rainbows/xaccept_epoll.rb b/lib/rainbows/xaccept_epoll.rb new file mode 100644 index 0000000..0690c07 --- /dev/null +++ b/lib/rainbows/xaccept_epoll.rb @@ -0,0 +1,25 @@ +# -*- encoding: binary -*- +# :enddoc: +require 'raindrops' +require 'rainbows/epoll' + +# Edge-triggered epoll concurrency model with blocking accept() in +# a (hopefully) native thread. This is recommended over Epoll for +# Ruby 1.9 users as it can workaround accept()-scalability issues +# on multicore machines. +module Rainbows::XAcceptEpoll + include Rainbows::Base + autoload :Client, 'rainbows/xaccept_epoll/client' + + def init_worker_process(worker) + super + Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new + trap(:QUIT) { Rainbows::Epoll.quit! } + Rainbows::Client.__send__ :include, Client + end + + def worker_loop(worker) # :nodoc: + init_worker_process(worker) + Client.run + end +end |