* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
(RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT) (RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value. * thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto. * signal.c (signal_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
58543f00b6
commit
66e2e6ee69
@ -1,3 +1,11 @@
|
|||||||
|
Mon Nov 26 21:16:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
|
||||||
|
(RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT)
|
||||||
|
(RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value.
|
||||||
|
* thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto.
|
||||||
|
* signal.c (signal_exec): ditto.
|
||||||
|
|
||||||
Mon Nov 26 20:23:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Mon Nov 26 20:23:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* thread.c (thread_join_m): use th->interrupt_mask instead of
|
* thread.c (thread_join_m): use th->interrupt_mask instead of
|
||||||
|
2
signal.c
2
signal.c
@ -627,7 +627,7 @@ signal_exec(VALUE cmd, int safe, int sig)
|
|||||||
volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
|
volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
cur_th->interrupt_mask |= 0x08;
|
cur_th->interrupt_mask |= TRAP_INTERRUPT_MASK;
|
||||||
TH_PUSH_TAG(cur_th);
|
TH_PUSH_TAG(cur_th);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
VALUE signum = INT2NUM(sig);
|
VALUE signum = INT2NUM(sig);
|
||||||
|
11
thread.c
11
thread.c
@ -810,7 +810,8 @@ thread_join_m(int argc, VALUE *argv, VALUE self)
|
|||||||
double delay = DELAY_INFTY;
|
double delay = DELAY_INFTY;
|
||||||
VALUE limit;
|
VALUE limit;
|
||||||
|
|
||||||
if (cur_th->interrupt_mask & 0x08) {
|
/* When running trap handler */
|
||||||
|
if (cur_th->interrupt_mask & TRAP_INTERRUPT_MASK) {
|
||||||
rb_raise(rb_eThreadError, "can't be called from trap context");
|
rb_raise(rb_eThreadError, "can't be called from trap context");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1747,10 +1748,10 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing)
|
|||||||
if (!interrupt)
|
if (!interrupt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
timer_interrupt = interrupt & 0x01;
|
timer_interrupt = interrupt & TIMER_INTERRUPT_MASK;
|
||||||
async_errinfo_interrupt = interrupt & 0x02;
|
async_errinfo_interrupt = interrupt & ASYNC_ERRINFO_INTERRUPT_MASK;
|
||||||
finalizer_interrupt = interrupt & 0x04;
|
finalizer_interrupt = interrupt & FINALIZER_INTERRUPT_MASK;
|
||||||
trap_interrupt = interrupt & 0x08;
|
trap_interrupt = interrupt & TRAP_INTERRUPT_MASK;
|
||||||
|
|
||||||
th->status = THREAD_RUNNABLE;
|
th->status = THREAD_RUNNABLE;
|
||||||
|
|
||||||
|
17
vm_core.h
17
vm_core.h
@ -855,11 +855,18 @@ GET_THREAD(void)
|
|||||||
#error "unsupported thread model"
|
#error "unsupported thread model"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x01)
|
enum {
|
||||||
#define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x02)
|
TIMER_INTERRUPT_MASK = 0x01,
|
||||||
#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x04)
|
ASYNC_ERRINFO_INTERRUPT_MASK = 0x02,
|
||||||
#define RUBY_VM_SET_TRAP_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x08)
|
FINALIZER_INTERRUPT_MASK = 0x04,
|
||||||
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x0A & ~(th)->interrupt_mask)
|
TRAP_INTERRUPT_MASK = 0x08
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TIMER_INTERRUPT_MASK)
|
||||||
|
#define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, ASYNC_ERRINFO_INTERRUPT_MASK)
|
||||||
|
#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, FINALIZER_INTERRUPT_MASK)
|
||||||
|
#define RUBY_VM_SET_TRAP_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TRAP_INTERRUPT_MASK)
|
||||||
|
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (ASYNC_ERRINFO_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
|
||||||
#define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
|
#define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
|
||||||
|
|
||||||
int rb_signal_buff_size(void);
|
int rb_signal_buff_size(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user