From f84f4aa6b375290386c0456ac02fe8f6cc2cdd2d Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 16 May 2001 09:05:54 +0000 Subject: * array.c (rb_ary_and): should not push frozen key string. * array.c (rb_ary_or): ditto. * eval.c (rb_thread_schedule): should save context before raising deadlock, saved context for current thread might be obsolete. * time.c (make_time_t): non DST timezone shift supported (hopefully). * time.c (make_time_t): strict range detection for negative time_t. * signal.c: SIGINFO added. * eval.c (rb_ensure): should not SEGV when prot_tag is NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 5e6d4d0d46..383f266e7d 100644 --- a/eval.c +++ b/eval.c @@ -4004,9 +4004,9 @@ rb_ensure(b_proc, data1, e_proc, data2) result = (*b_proc)(data1); } POP_TAG(); - retval = prot_tag->retval; /* save retval */ + retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */ (*e_proc)(data2); - return_value(retval); + if (prot_tag) return_value(retval); if (state) JUMP_TAG(state); return result; @@ -7551,6 +7551,7 @@ rb_thread_schedule() next->gid = 0; rb_thread_ready(next); next->status = THREAD_TO_KILL; + rb_thread_save_context(curr_thread); rb_thread_deadlock(); } next->wait_for = 0; @@ -8338,8 +8339,20 @@ rb_thread_stop_p(thread) static void rb_thread_wait_other_threads() { + rb_thread_t th; + int found; + /* wait other threads to terminate */ while (curr_thread != curr_thread->next) { + found = 0; + FOREACH_THREAD(th) { + if (th != curr_thread && th->status != THREAD_STOPPED) { + found = 1; + break; + } + } + END_FOREACH(th); + if (!found) return; rb_thread_schedule(); } } -- cgit v1.2.3