* eval.c (rb_thread_schedule): raise FATAL just once to

THREAD_TO_KILL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-03-14 08:39:13 +00:00
Родитель 53ff8df72f
Коммит 1fd502ccc1
3 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Wed Mar 14 16:41:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_schedule): raise FATAL just once to
THREAD_TO_KILL.
Wed Mar 14 10:41:34 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): 0 (= Qfalse) is a valid value, so that

14
eval.c
Просмотреть файл

@ -6881,7 +6881,9 @@ struct thread {
VALUE thread;
};
#define THREAD_RAISED 0x200
#define THREAD_RAISED 0x200 /* temporary flag */
#define THREAD_TERMINATING 0x400 /* persistent flag */
#define THREAD_FLAGS_MASK 0x400 /* mask for persistent flags */
#define FOREACH_THREAD_FROM(f,x) x = f; do { x = x->next;
#define END_FOREACH_FROM(f,x) } while (x != f)
@ -7033,7 +7035,8 @@ rb_thread_save_context(th)
th->wrapper = ruby_wrapper;
th->dyna_vars = ruby_dyna_vars;
th->block = ruby_block;
th->flags = scope_vmode | (rb_trap_immediate<<8);
th->flags &= THREAD_FLAGS_MASK;
th->flags |= (rb_trap_immediate<<8) | scope_vmode;
th->iter = ruby_iter;
th->tag = prot_tag;
th->tracing = tracing;
@ -7459,8 +7462,11 @@ rb_thread_schedule()
curr_thread = next;
if (next->status == THREAD_TO_KILL) {
/* execute ensure-clause if any */
rb_thread_restore_context(next, RESTORE_FATAL);
if (!(next->flags & THREAD_TERMINATING)) {
next->flags |= THREAD_TERMINATING;
/* terminate; execute ensure-clause if any */
rb_thread_restore_context(next, RESTORE_FATAL);
}
}
rb_thread_restore_context(next, RESTORE_NORMAL);
}

Просмотреть файл

@ -185,7 +185,7 @@ class Queue
end
end
def shift(non_block=false)
pop(non_block=false)
pop(non_block)
end
alias deq shift