From 6ae020c9ac483d822902b5d33f038f79b44d3a50 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Dec 2010 02:30:58 +0000 Subject: writer_thread_*: split out classes into separate files Use a consistent "Client" naming to reduce confusion --- lib/rainbows/writer_thread_pool/client.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/rainbows/writer_thread_pool/client.rb (limited to 'lib/rainbows/writer_thread_pool') diff --git a/lib/rainbows/writer_thread_pool/client.rb b/lib/rainbows/writer_thread_pool/client.rb new file mode 100644 index 0000000..5889e84 --- /dev/null +++ b/lib/rainbows/writer_thread_pool/client.rb @@ -0,0 +1,19 @@ +# -*- encoding: binary -*- +# +# used to wrap a BasicSocket to use with +q+ for all writes +# this is compatible with IO.select +class Rainbows::WriterThreadPool::Client < Struct.new(:to_io, :q) # :nodoc: + include Rainbows::SocketProxy + + def write(buf) + q << [ to_io, buf ] + end + + def close + q << [ to_io, :close ] + end + + def closed? + false + end +end -- cgit v1.2.3-24-ge0c7