From b3a8d6aeccf2d865450b883d8b5cc166442f6205 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 22 Jul 2010 09:13:45 +0000 Subject: writer_thread_pool: fix include ordering issues under 1.8 This was always an issue, but not noticed until 0cd65fa1e01be369b270c72053cf21a3d6bcb45f ... --- lib/rainbows/writer_thread_pool.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/rainbows/writer_thread_pool.rb b/lib/rainbows/writer_thread_pool.rb index dd3dd7c..c4d8d9f 100644 --- a/lib/rainbows/writer_thread_pool.rb +++ b/lib/rainbows/writer_thread_pool.rb @@ -46,25 +46,25 @@ module Rainbows end end - module Response # :nodoc: - def write_body(qclient, body, range) - qclient.q << [ qclient.to_io, :body, body, range ] - end - end - @@nr = 0 @@q = nil + def async_write_body(qclient, body, range) + qclient.q << [ qclient.to_io, :body, body, range ] + end + def process_client(client) # :nodoc: @@nr += 1 - super(QueueSocket[client, @@q[@@nr %= @@q.size]]) + super(QueueSocket.new(client, @@q[@@nr %= @@q.size])) end - def worker_loop(worker) # :nodoc: - Rainbows::Response.setup(self.class) + def init_worker_process(worker) + super self.class.__send__(:alias_method, :sync_write_body, :write_body) - self.class.__send__(:include, Response) + WriterThreadPool.__send__(:alias_method, :write_body, :async_write_body) + end + def worker_loop(worker) # :nodoc: # we have multiple, single-thread queues since we don't want to # interleave writes from the same client qp = (1..worker_connections).map do |n| -- cgit v1.2.3-24-ge0c7