summaryrefslogtreecommitdiff
path: root/spec/ruby/library/io-wait/fixtures/classes.rb
blob: 837c7edd06bea40ef0482ec7d245f11183cad3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module IOWaitSpec
  def self.exhaust_write_buffer(io)
    written = 0
    buf = " " * 4096

    begin
      written += io.write_nonblock(buf)
    rescue Errno::EAGAIN, Errno::EWOULDBLOCK
      return written
    end while true
  end
end