diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-30 22:29:34 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-30 22:29:34 +0000 |
commit | fa4514e4fedc1e1390200e3901e2add22a4a27b4 (patch) | |
tree | 1570296a48f3bd30e36bf682431defe49f05846e /signal.c | |
parent | 198c2570e740280bf7f00a38d311ade19c27fef7 (diff) |
* thread.c (rb_threadptr_check_signal): only wake up main thread.
* thread.c (rb_threadptr_execute_interrupts_common): check signal
deliverly if it is main thread.
fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950]
* bootstraptest/test_fork.rb: add a test for above.
* signal.c (rb_get_next_signal): skip if signal_buff is empty.
(check signal_buff.size first)
* vm_core.h: remove unused variable rb_thread_t::exec_signal.
* thread.c (rb_thread_check_trap_pending): check
rb_signal_buff_size() because rb_thread_t::exec_signal
is no longer available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r-- | signal.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -554,16 +554,18 @@ rb_get_next_signal(void) { int i, sig = 0; - for (i=1; i<RUBY_NSIG; i++) { - if (signal_buff.cnt[i] > 0) { - rb_disable_interrupt(); - { - ATOMIC_DEC(signal_buff.cnt[i]); - ATOMIC_DEC(signal_buff.size); + if (signal_buff.size != 0) { + for (i=1; i<RUBY_NSIG; i++) { + if (signal_buff.cnt[i] > 0) { + rb_disable_interrupt(); + { + ATOMIC_DEC(signal_buff.cnt[i]); + ATOMIC_DEC(signal_buff.size); + } + rb_enable_interrupt(); + sig = i; + break; } - rb_enable_interrupt(); - sig = i; - break; } } return sig; |