epoll: handle EINTR properly in Ruby-space
[rainbows.git] / lib / rainbows / xaccept_epoll.rb
blob94ad33238fdebd1c8bf81c079d8003bc1facfe10
1 # -*- encoding: binary -*-
2 # :enddoc:
3 require 'raindrops'
4 require 'rainbows/epoll'
6 # Edge-triggered epoll concurrency model with blocking accept() in
7 # a (hopefully) native thread.  This is recommended over Epoll for
8 # Ruby 1.9 users as it can workaround accept()-scalability issues
9 # on multicore machines.
10 module Rainbows::XAcceptEpoll
11   include Rainbows::Base
12   autoload :Client, 'rainbows/xaccept_epoll/client'
14   def init_worker_process(worker)
15     super
16     Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new
17     Rainbows::Client.__send__ :include, Client
18   end
20   def worker_loop(worker) # :nodoc:
21     init_worker_process(worker)
22     Client.run
23   end
24 end