summaryrefslogtreecommitdiff
path: root/benchmark/io_close_contended.yml
blob: 1d9e4e0d0f86367e4a3860d24d5f41c1d3d901f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
prelude: |
  ios = 100.times.map do
    10.times.map do
      pipe = IO.pipe.tap do |r, w|
        Thread.new do
          r.read
        rescue IOError
          # Ignore
        end
      end
    end
  end
benchmark:
  # Close IO
  io_close_contended: |
    # Process each batch of ios per iteration of the benchmark.
    ios.pop.each do |r, w|
      r.close
      w.close
    end
loop_count: 10