diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-31 07:00:38 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-31 07:00:38 +0000 |
commit | bfdfc99cc2ea49f15b1380516bd341f4e7b425b6 (patch) | |
tree | 744d11534cfc0b523b9f2b6b0de76918a5523922 /test | |
parent | 6897b3b9854eb54afd6898830e9935ce68a276de (diff) | |
download | ruby-bfdfc99cc2ea49f15b1380516bd341f4e7b425b6.tar.gz |
allow Queue operation in trap.
* thread_sync.c: allow spurious wakeup to check Queue status just after trap.
[Bug #12405]
* test/thread/test_queue.rb: add a test for it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/thread/test_queue.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb index e1821da0de..6122d9b87c 100644 --- a/test/thread/test_queue.rb +++ b/test/thread/test_queue.rb @@ -547,4 +547,21 @@ class TestQueue < Test::Unit::TestCase # don't leak this thread assert_nothing_raised{counter.join} end + + def test_queue_with_trap + assert_in_out_err([], <<-INPUT, %w(USR2 USR2 exit), []) + q = Queue.new + trap(:USR2){ + q.push 'USR2' + } + Thread.new{ + loop{ + Process.kill :USR2, $$ + } + } + puts q.pop + puts q.pop + puts 'exit' + INPUT + end end |