Sha256: e8f560246ab1dd500da138262b3733493ede34a334851454fca8d1831e5ebebb

Contents?: true

Size: 700 Bytes

Versions: 8

Compression:

Stored size: 700 Bytes

Contents

# -*- encoding: binary -*-
require 'test/unit'
require 'tempfile'
require 'socket'
require 'io/nonblock'
require 'timeout'
$-w = true
require 'io/splice'
Thread.abort_on_exception = true

class Test_IO_Splice_EINTR < Test::Unit::TestCase
  def setup
    @usr1 = 0
    trap(:USR1) { @usr1 += 1 }
  end

  def teardown
    trap(:USR1, "DEFAULT")
  end

  def test_EINTR_splice_read
    rd, wr = IO.pipe
    tmp = Tempfile.new 'splice-read'
    main = Thread.current
    Thread.new do
      sleep 0.01
      Process.kill(:USR1, $$)
      sleep 0.01
      wr.write "HI"
    end
    nr = IO.splice rd, nil, tmp, nil, 666
    assert_equal 2, nr
    assert_equal 1, @usr1
  end
end if defined?(RUBY_ENGINE)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
io_splice-4.4.2 test/test_io_splice_eintr.rb
io_splice-4.4.1 test/test_io_splice_eintr.rb
io_splice-4.4.0 test/test_io_splice_eintr.rb
io_splice-4.3.0 test/test_io_splice_eintr.rb
io_splice-4.2.0 test/test_io_splice_eintr.rb
io_splice-4.1.1 test/test_io_splice_eintr.rb
io_splice-4.1.0 test/test_io_splice_eintr.rb
io_splice-4.0.0 test/test_io_splice_eintr.rb