diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-20 12:26:14 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-20 12:26:14 +0000 |
commit | e120cc91f0fedc876e23259ecdb9fb65c71e57dd (patch) | |
tree | 440a1259f2547df297909efe4ebd40f5ecf81d51 /test | |
parent | 26b9fb4711898189b00ef93183ef9e831f816d63 (diff) |
merge revision(s) 57477,57478,57479: [Backport #12405]
use TRUE/FALSE.
define rb_thread_sleep_deadly_allow_spurious_wakeup().
* thread.c, thread_sync.c: define new function
rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of
using sleep_forever() directly.
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/branches/ruby_2_3@58036 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 e59728b980..c9ea9f063f 100644 --- a/test/thread/test_queue.rb +++ b/test/thread/test_queue.rb @@ -541,4 +541,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 |