* 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
This commit is contained in:
parent
5b46f6c602
commit
90425153fb
@ -1,3 +1,8 @@
|
|||||||
|
Wed Sep 11 07:55:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
|
||||||
|
an exception even if uses on trap. [Bug #8891]
|
||||||
|
|
||||||
Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@tubusu.net>
|
Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@tubusu.net>
|
||||||
|
|
||||||
* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
|
* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
|
||||||
|
@ -849,6 +849,23 @@ Thread.new(Thread.current) {|mth|
|
|||||||
end
|
end
|
||||||
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
|
def invoke_rec script, vm_stack_size, machine_stack_size, use_length = true
|
||||||
env = {}
|
env = {}
|
||||||
env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size
|
env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size
|
||||||
|
5
thread.c
5
thread.c
@ -4481,11 +4481,6 @@ rb_mutex_unlock(VALUE self)
|
|||||||
rb_mutex_t *mutex;
|
rb_mutex_t *mutex;
|
||||||
GetMutexPtr(self, mutex);
|
GetMutexPtr(self, mutex);
|
||||||
|
|
||||||
/* When running trap handler */
|
|
||||||
if (!mutex->allow_trap && GET_THREAD()->interrupt_mask & TRAP_INTERRUPT_MASK) {
|
|
||||||
rb_raise(rb_eThreadError, "can't be called from trap context");
|
|
||||||
}
|
|
||||||
|
|
||||||
err = rb_mutex_unlock_th(mutex, GET_THREAD());
|
err = rb_mutex_unlock_th(mutex, GET_THREAD());
|
||||||
if (err) rb_raise(rb_eThreadError, "%s", err);
|
if (err) rb_raise(rb_eThreadError, "%s", err);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user