use and recommend sleepy_penguin 3.0.0
[rainbows.git] / lib / rainbows / xepoll.rb
blobfa08e91203fe18a675de6acc4e7d12510e556205
1 # -*- encoding: binary -*-
2 require 'raindrops'
3 require 'rainbows/epoll'
5 # Edge-triggered epoll concurrency model with blocking accept() in a
6 # (hopefully) native thread.  This is just like Epoll, but recommended
7 # for Ruby 1.9 users as it can avoid accept()-scalability issues on
8 # multicore machines with many worker processes.
10 # === RubyGem Requirements
12 # * raindrops 0.6.0 or later
13 # * sleepy_penguin 3.0.0 or later
14 # * sendfile 1.1.0 or later
15 module Rainbows::XEpoll
16   # :stopdoc:
17   include Rainbows::Base
18   autoload :Client, 'rainbows/xepoll/client'
20   def init_worker_process(worker)
21     super
22     Rainbows.const_set(:EP, SleepyPenguin::Epoll.new)
23     Rainbows::Client.__send__ :include, Client
24   end
26   def worker_loop(worker) # :nodoc:
27     init_worker_process(worker)
28     Client.loop
29   end
30   # :startdoc:
31 end