diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-04 18:58:26 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-04 18:58:26 -0800 |
commit | 8e2e8adda8adbadee8ab31cde700b7e486b1154c (patch) | |
tree | b4fadc909c9636486ee8e1bebd735786063b9af7 /lib/rainbows/xepoll.rb | |
parent | 0f4f015737297ac5245d0be9ee83553770ade0a9 (diff) | |
download | rainbows-8e2e8adda8adbadee8ab31cde700b7e486b1154c.tar.gz |
It's too long especially since XEpollThreadPool is planned :>
Diffstat (limited to 'lib/rainbows/xepoll.rb')
-rw-r--r-- | lib/rainbows/xepoll.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/rainbows/xepoll.rb b/lib/rainbows/xepoll.rb new file mode 100644 index 0000000..3a02b46 --- /dev/null +++ b/lib/rainbows/xepoll.rb @@ -0,0 +1,24 @@ +# -*- 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::XEpoll + include Rainbows::Base + autoload :Client, 'rainbows/xepoll/client' + + def init_worker_process(worker) + super + Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new + Rainbows::Client.__send__ :include, Client + end + + def worker_loop(worker) # :nodoc: + init_worker_process(worker) + Client.run + end +end |