summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 10:57:39 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 10:57:39 +0000
commit6190bb4d8ad7a07ddb1da8fc687b20612743a34a (patch)
tree72600b2de79b50643fde443dd7eb1a6b9a331344 /signal.c
parent8c6ad2b0ae9a0d5c2205f4648e5fa0c86fa6077f (diff)
* ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.
* vm_core.h (struct rb_thread_struct): add interrupt_mask member. * thread.c (thread_create_core, Init_Thread): initialize th->thread_mask. * vm_core.h (RUBY_VM_INTERRUPTED_ANY): new macro for avoiding bare th->interrupt_flag. * vm_core.h (RUBY_VM_INTERRUPTED, RUBY_VM_INTERRUPTED): check th->interrupt_mask. * thread.c (set_unblock_function, rb_thread_schedule): replace th->interrupt_flag with RUBY_VM_INTERRUPTED_ANY() * signal.c (signal_exec): set up thread->interrupt_mask for preventing recursive trap handler. * vm_core.h (RUBY_VM_CHECK_INTS, RUBY_VM_CHECK_INTS_BLOCKING): ditto. * thread.c (rb_threadptr_execute_interrupts): don't process interrupt if it is masked. [Bug #6009] [ruby-core:42524] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 713e5cd5b6..4538d901f6 100644
--- a/signal.c
+++ b/signal.c
@@ -625,9 +625,11 @@ signal_exec(VALUE cmd, int safe, int sig)
{
rb_thread_t *cur_th = GET_THREAD();
volatile int old_in_trap = cur_th->in_trap;
+ volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
int state;
cur_th->in_trap = 1;
+ cur_th->interrupt_mask |= 0x08;
TH_PUSH_TAG(cur_th);
if ((state = EXEC_TAG()) == 0) {
VALUE signum = INT2NUM(sig);
@@ -635,6 +637,7 @@ signal_exec(VALUE cmd, int safe, int sig)
}
TH_POP_TAG();
cur_th = GET_THREAD();
+ cur_th->interrupt_mask = old_interrupt_mask;
cur_th->in_trap = old_in_trap;
if (state) {