rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 3cc33354e9ff4767ae3d5d4a60908560f52f7d09 361 bytes (raw)
$ git show v2.1.0:lib/rainbows/writer_thread_pool/client.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 
# -*- encoding: binary -*-
# :enddoc:
# 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)
  include Rainbows::SocketProxy

  def write(buf)
    q << [ to_io, buf ]
  end

  def close
    q << [ to_io, :close ]
  end

  def closed?
    false
  end
end

git clone https://yhbt.net/rainbows.git