Sha256: e5c409446c5c8c8131397e90d7208e42fc880a7fa72e128ea32a60b168a75467

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

# -*- encoding: binary -*-
require_relative 'helper'
require 'tempfile'
require 'socket'
require 'timeout'

class Test_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 = SleepyPenguin.splice rd, tmp, 666
    assert_equal 2, nr
    assert_equal 1, @usr1
  end
end if SleepyPenguin.respond_to?(:splice)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sleepy_penguin-3.5.2 test/test_splice_eintr.rb
sleepy_penguin-3.5.1 test/test_splice_eintr.rb
sleepy_penguin-3.5.0 test/test_splice_eintr.rb