summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-10 10:57:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-10 10:57:26 +0000
commitc54c60da26c5544e073e9cac8e6c2474e9b492f9 (patch)
tree531555703ad98fe96ab30769827d9b109c2e52b7 /thread.c
parentff3496b0116ed2ed589d000b7bfca3d8288b009c (diff)
downloadruby-c54c60da26c5544e073e9cac8e6c2474e9b492f9.tar.gz
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
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/thread.c b/thread.c
index 71e479d38c..c94c3b93ab 100644
--- a/thread.c
+++ b/thread.c
@@ -1587,19 +1587,23 @@ rb_threadptr_pending_interrupt_check_mask(rb_thread_t *th, VALUE err)
VALUE mask;
long mask_stack_len = RARRAY_LEN(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 */
- long ancestors_len = RARRAY_LEN(ancestors);
- const VALUE *ancestors_ptr = RARRAY_CONST_PTR(ancestors);
- int i, j;
+ VALUE mod;
+ long i;
for (i=0; i<mask_stack_len; i++) {
mask = mask_stack[mask_stack_len-(i+1)];
- for (j=0; j<ancestors_len; j++) {
- VALUE klass = ancestors_ptr[j];
+ for (mod = err; mod; mod = RCLASS_SUPER(mod)) {
+ VALUE klass = mod;
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 == sym_immediate) {
return INTERRUPT_IMMEDIATE;