summary refs log tree commit homepage
path: root/lib/rainbows/writer_thread_pool
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-27 02:30:58 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-27 02:30:58 +0000
commit6ae020c9ac483d822902b5d33f038f79b44d3a50 (patch)
tree98b1ef14929bb868cb3cf32867c4e0962ee91432 /lib/rainbows/writer_thread_pool
parente7d295fd8e3628eba7a1ba52e95b7dee11532e98 (diff)
Use a consistent "Client" naming to reduce confusion
Diffstat (limited to 'lib/rainbows/writer_thread_pool')
-rw-r--r--lib/rainbows/writer_thread_pool/client.rb19
1 files changed, 19 insertions, 0 deletions
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