From 90425153fbd26f9e5bdaa0a2df805b2a37350e9b Mon Sep 17 00:00:00 2001 From: kosaki Date: Tue, 10 Sep 2013 23:21:17 +0000 Subject: * thread.c (rb_mutex_unlock): Mutex#unlock no longer raise an exception even if uses on trap. [Bug #8891] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/ruby/test_thread.rb') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index dd13842bfe..bc3c025253 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -849,6 +849,23 @@ Thread.new(Thread.current) {|mth| end end + def test_mutex_unlock_on_trap + assert_in_out_err([], <<-INPUT, %w(locked unlocked false), []) + m = Mutex.new + + Signal.trap("INT") { |signo| + m.unlock + puts "unlocked" + } + + m.lock + puts "locked" + Process.kill("INT", $$) + sleep 0.01 + puts m.locked? + INPUT + end + def invoke_rec script, vm_stack_size, machine_stack_size, use_length = true env = {} env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size -- cgit v1.2.3