* eval.c (rb_thread_start_0): update curr_thread before raising

TAG_THREAD.  [ruby-dev:25712]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-02-22 14:57:43 +00:00
Родитель 984f9a0df1
Коммит 9001cbdfad
2 изменённых файлов: 18 добавлений и 7 удалений

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

@ -19,6 +19,11 @@ Tue Feb 22 23:50:26 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* signal.c (ruby_signal, ruby_nativethread_signal): must be valid as * signal.c (ruby_signal, ruby_nativethread_signal): must be valid as
expressions, not only statements. expressions, not only statements.
Tue Feb 22 12:54:13 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_start_0): update curr_thread before raising
TAG_THREAD. [ruby-dev:25712]
Tue Feb 22 07:24:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Feb 22 07:24:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_yylex): identifier after dot must not be a variable. * parse.y (parser_yylex): identifier after dot must not be a variable.

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

@ -9941,6 +9941,11 @@ thread_mark(th)
} }
} }
static struct {
rb_thread_t thread;
VALUE proc, arg;
} new_thread;
void void
rb_gc_mark_threads() rb_gc_mark_threads()
{ {
@ -9953,6 +9958,11 @@ rb_gc_mark_threads()
FOREACH_THREAD(th) { FOREACH_THREAD(th) {
rb_gc_mark(th->thread); rb_gc_mark(th->thread);
} END_FOREACH(th); } END_FOREACH(th);
if (new_thread.thread) {
rb_gc_mark(new_thread.thread->thread);
rb_gc_mark(new_thread.proc);
rb_gc_mark(new_thread.arg);
}
} }
static void static void
@ -11603,11 +11613,6 @@ thread_insert(th)
} }
} }
static struct {
rb_thread_t thread;
VALUE proc, arg;
} new_thread;
static VALUE static VALUE
rb_thread_start_0(fn, arg, th) rb_thread_start_0(fn, arg, th)
VALUE (*fn)(); VALUE (*fn)();
@ -11652,6 +11657,8 @@ rb_thread_start_0(fn, arg, th)
new_thread.proc = rb_block_proc(); new_thread.proc = rb_block_proc();
new_thread.arg = (VALUE)arg; new_thread.arg = (VALUE)arg;
th->anchor = ip; th->anchor = ip;
thread_insert(th);
curr_thread = th;
longjmp((prot_tag = ip->tag)->buf, TAG_THREAD); longjmp((prot_tag = ip->tag)->buf, TAG_THREAD);
} }
@ -11747,8 +11754,6 @@ rb_thread_start_1()
enum thread_status status; enum thread_status status;
int state; int state;
thread_insert(th);
ruby_frame = ip->frame; ruby_frame = ip->frame;
ruby_block = ip->block; ruby_block = ip->block;
ruby_scope = ip->scope; ruby_scope = ip->scope;
@ -11762,6 +11767,7 @@ rb_thread_start_1()
PUSH_TAG(PROT_NONE); PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
if (THREAD_SAVE_CONTEXT(th) == 0) { if (THREAD_SAVE_CONTEXT(th) == 0) {
new_thread.thread = 0;
curr_thread = th; curr_thread = th;
th->result = rb_block_pass(rb_thread_yield_0, arg, proc); th->result = rb_block_pass(rb_thread_yield_0, arg, proc);
} }