about summary refs log tree commit homepage
path: root/test/test_poll.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_poll.rb')
-rw-r--r--test/test_poll.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_poll.rb b/test/test_poll.rb
index 1c92223..d99e5aa 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -70,4 +70,24 @@ class TestPoll < Test::Unit::TestCase
     ensure
       trap(:USR1, orig)
   end
+
+  def test_poll_EINTR_changed
+    ok = false
+    orig = trap(:USR1) { ok = true }
+    pollset = { @rd => Kgio::POLLIN }
+    thr = Thread.new do
+      sleep 0.100
+      pollset[@wr] = Kgio::POLLOUT
+      Process.kill(:USR1, $$)
+    end
+    t0 = Time.now
+    res = Kgio.poll(pollset, 1000)
+    diff = Time.now - t0
+    thr.join
+    assert_equal({@wr => Kgio::POLLOUT}, res)
+    assert diff < 1.0, "diff=#{diff}"
+    assert ok
+    ensure
+      trap(:USR1, orig)
+  end
 end if Kgio.respond_to?(:poll)