diff options
author | Eric Wong <e@yhbt.net> | 2013-09-03 22:45:26 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-09-03 23:35:15 +0000 |
commit | 377028d998f32c9bf8926a275019445103328c3d (patch) | |
tree | 58a6a30aa71d65b7cb1cb14e6b770e0e01cd65ae | |
parent | 259347346169d4a2ab5b33719fe0985edc64bd3c (diff) | |
download | kgio-377028d998f32c9bf8926a275019445103328c3d.tar.gz |
Modifying pollset in a different pollset is thread-unsafe, so just do that inside the signal handler as that should fire before restarting poll().
-rw-r--r-- | test/test_poll.rb | 6 |
1 files 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 |