rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 3a02b4675abf88d82883ffad7e14167958e42dce 655 bytes (raw)
$ git show v3.2.0:lib/rainbows/xepoll.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

git clone https://yhbt.net/rainbows.git