diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-03-07 08:37:11 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-03-07 08:37:11 +0000 |
commit | 92dca5e5554e056f892fcb6cae20693b39b4044b (patch) | |
tree | 737654b47ad61c3aa528da83a5e365fd474d59a4 | |
parent | 3a847e231d494829077a300912588f499c0bc2af (diff) | |
download | kgio-92dca5e5554e056f892fcb6cae20693b39b4044b.tar.gz |
poll(2) may return successfully before it gets interrupted by the signal. Found and fix confirmed by 375gnu on the kgio mailing list. ref: <CAAB-Kcm=_CRa4UoSQt+C4cHk6z2Rpfsv6_KXPHV3R34Gt6sLiQ@mail.gmail.com>
-rw-r--r-- | test/test_poll.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_poll.rb b/test/test_poll.rb index ba0e561..df59354 100644 --- a/test/test_poll.rb +++ b/test/test_poll.rb @@ -58,7 +58,10 @@ class TestPoll < Test::Unit::TestCase res = nil thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) } t0 = Time.now - assert_raises(IOError) { Kgio.poll({@rd => Kgio::POLLIN}) } + assert_raises(IOError) do + result = Kgio.poll({@rd => Kgio::POLLIN}) + result.each_key { |io| io.read_nonblock(1) } + end diff = Time.now - t0 thr.join assert diff >= 0.010, "diff=#{diff}" |