class Puma::ErrorLogger

def internal_write(str)

def internal_write(str)
  LOG_QUEUE << str
  while (w_str = LOG_QUEUE.pop(true)) do
    begin
      @ioerr.is_a?(IO) and @ioerr.wait_writable(1)
      @ioerr.write "#{w_str}\n"
      @ioerr.flush unless @ioerr.sync
    rescue Errno::EPIPE, Errno::EBADF, IOError, Errno::EINVAL
    # 'Invalid argument' (Errno::EINVAL) may be raised by flush
    end
  end
rescue ThreadError
end