mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: fix todo
* thread.c (rb_threadptr_pending_interrupt_check_mask): traverse the super class chain instead of making ancestors array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ff3496b011
commit
c54c60da26
1 changed files with 11 additions and 7 deletions
18
thread.c
18
thread.c
|
@ -1587,19 +1587,23 @@ rb_threadptr_pending_interrupt_check_mask(rb_thread_t *th, VALUE err)
|
||||||
VALUE mask;
|
VALUE mask;
|
||||||
long mask_stack_len = RARRAY_LEN(th->pending_interrupt_mask_stack);
|
long mask_stack_len = RARRAY_LEN(th->pending_interrupt_mask_stack);
|
||||||
const VALUE *mask_stack = RARRAY_CONST_PTR(th->pending_interrupt_mask_stack);
|
const VALUE *mask_stack = RARRAY_CONST_PTR(th->pending_interrupt_mask_stack);
|
||||||
VALUE ancestors = rb_mod_ancestors(err); /* TODO: GC guard */
|
VALUE mod;
|
||||||
long ancestors_len = RARRAY_LEN(ancestors);
|
long i;
|
||||||
const VALUE *ancestors_ptr = RARRAY_CONST_PTR(ancestors);
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i=0; i<mask_stack_len; i++) {
|
for (i=0; i<mask_stack_len; i++) {
|
||||||
mask = mask_stack[mask_stack_len-(i+1)];
|
mask = mask_stack[mask_stack_len-(i+1)];
|
||||||
|
|
||||||
for (j=0; j<ancestors_len; j++) {
|
for (mod = err; mod; mod = RCLASS_SUPER(mod)) {
|
||||||
VALUE klass = ancestors_ptr[j];
|
VALUE klass = mod;
|
||||||
VALUE sym;
|
VALUE sym;
|
||||||
|
|
||||||
/* TODO: remove rb_intern() */
|
if (BUILTIN_TYPE(mod) == T_ICLASS) {
|
||||||
|
klass = RBASIC(mod)->klass;
|
||||||
|
}
|
||||||
|
else if (mod != RCLASS_ORIGIN(mod)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((sym = rb_hash_aref(mask, klass)) != Qnil) {
|
if ((sym = rb_hash_aref(mask, klass)) != Qnil) {
|
||||||
if (sym == sym_immediate) {
|
if (sym == sym_immediate) {
|
||||||
return INTERRUPT_IMMEDIATE;
|
return INTERRUPT_IMMEDIATE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue