about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-08-29 17:33:43 -0700
committerEric Wong <normalperson@yhbt.net>2011-08-29 17:35:11 -0700
commit4cef568a9d06033c295c1f4920918c6fed36a24d (patch)
tree7d0b718b1c2628203558fc61a3a81864659bc9b0 /test
parentbb37d358b3326a03a69f65e12c775bb9861b3ad5 (diff)
downloadkgio-4cef568a9d06033c295c1f4920918c6fed36a24d.tar.gz
This needs to work similarly to IO.select.
Diffstat (limited to 'test')
-rw-r--r--test/test_poll.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_poll.rb b/test/test_poll.rb
index 32d0a4d..ba0e561 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -53,6 +53,19 @@ class TestPoll < Test::Unit::TestCase
     assert diff >= 0.010, "diff=#{diff}"
   end
 
+  def test_signal_close
+    orig = trap(:USR1) { @rd.close }
+    res = nil
+    thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
+    t0 = Time.now
+    assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) }
+    diff = Time.now - t0
+    thr.join
+    assert diff >= 0.010, "diff=#{diff}"
+    ensure
+      trap(:USR1, orig)
+  end
+
   def test_poll_EINTR
     ok = false
     orig = trap(:USR1) { ok = true }