diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-12 17:11:50 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-12 17:11:50 +0000 |
commit | a6929d1d7e276184427d861797fff8cc7e9badb6 (patch) | |
tree | e27ae851e49e76b1d28e6a9385f30183502cfdf3 /test | |
parent | acdfd915207669e847940cc6a10be3b7218c7857 (diff) |
merge revision(s) 42906: [Backport #8891]
* 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/branches/ruby_2_0_0@42926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_thread.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 7913845da7..9cd55bcbed 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -877,6 +877,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 |