1 # -*- encoding: binary -*-
4 module Rainbows::XEpoll::Client
6 include Rainbows::Epoll::Client
7 ACCEPTORS = Rainbows::HttpServer::LISTENERS.dup
8 extend Rainbows::WorkerYield
10 def self.included(klass)
11 max = Rainbows.server.worker_connections
12 ACCEPTORS.map! do |sock|
15 if io = sock.kgio_accept(klass)
19 worker_yield while N[0] >= max
21 Rainbows::Error.listen_loop(e)
22 end while Rainbows.alive
29 EP.wait(nil, 1000) { |_, obj| obj.epoll_run }
30 Rainbows::Epoll::Client.expire
33 Rainbows::Error.listen_loop(e)
34 end while Rainbows.tick || N[0] > 0
35 Rainbows::JoinThreads.acceptors(ACCEPTORS)
40 @wr_queue = [] # may contain String, ResponsePipe, and StreamFile objects
42 EP.set(self, IN) # wake up the main thread
44 Rainbows::Error.write(self, e)