From 04b8649b3750a0002094e90a62f7566059c8a4e9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jan 2011 17:00:51 -0800 Subject: epoll: make Epoll.quit more reusable We'll be using this more in the future --- lib/rainbows/epoll.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rainbows/epoll.rb b/lib/rainbows/epoll.rb index 39c3a27..54d08fb 100644 --- a/lib/rainbows/epoll.rb +++ b/lib/rainbows/epoll.rb @@ -12,10 +12,15 @@ module Rainbows::Epoll autoload :ResponsePipe, 'rainbows/epoll/response_pipe' autoload :ResponseChunkPipe, 'rainbows/epoll/response_chunk_pipe' + def self.quit! + Rainbows.quit! + EP.close unless EP.closed? + end + def init_worker_process(worker) super Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new - trap(:QUIT) { Rainbows.quit!; EP.close unless EP.closed? } + trap(:QUIT) { Rainbows::Epoll.quit! } Rainbows::Client.__send__ :include, Client end -- cgit v1.2.3-24-ge0c7