From 377028d998f32c9bf8926a275019445103328c3d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 3 Sep 2013 22:45:26 +0000 Subject: test_poll: avoid potentially thread-unsafe test Modifying pollset in a different pollset is thread-unsafe, so just do that inside the signal handler as that should fire before restarting poll(). --- test/test_poll.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_poll.rb b/test/test_poll.rb index 3aa8c1f..13f5f2a 100644 --- a/test/test_poll.rb +++ b/test/test_poll.rb @@ -89,11 +89,13 @@ class TestPoll < Test::Unit::TestCase def test_poll_EINTR_changed ok = false - orig = trap(:USR1) { ok = true } pollset = { @rd => Kgio::POLLIN } + orig = trap(:USR1) do + pollset[@wr] = Kgio::POLLOUT + ok = true + end thr = Thread.new do sleep 0.100 - pollset[@wr] = Kgio::POLLOUT Process.kill(:USR1, $$) end t0 = Time.now -- cgit v1.2.3-24-ge0c7