diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-25 18:07:08 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-25 18:07:08 +0000 |
commit | d014f463cf6d5dd51aa2ce56385fc08ac5c121af (patch) | |
tree | 7d41c2db84af1220161c42569fce993b1b957c21 /test | |
parent | ed20b2561ce9a387da6de5f93a7b7931cd136efd (diff) |
merge revision(s) 57477,57478,57479,57492: [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.
test_queue.rb: fix portability
* test/thread/test_queue.rb (test_queue_with_trap): fix
portability. use SIGINT instead of SIGUSR2 which is supported
on not all platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58115 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 2bd71dbfc9..32c740277a 100644 --- a/test/thread/test_queue.rb +++ b/test/thread/test_queue.rb @@ -277,4 +277,21 @@ class TestQueue < Test::Unit::TestCase Marshal.dump(q) end end + + def test_queue_with_trap + assert_in_out_err([], <<-INPUT, %w(INT INT exit), []) + q = Queue.new + trap(:INT){ + q.push 'INT' + } + Thread.new{ + loop{ + Process.kill :INT, $$ + } + } + puts q.pop + puts q.pop + puts 'exit' + INPUT + end end |