aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-16 09:05:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-16 09:05:54 +0000
commitf84f4aa6b375290386c0456ac02fe8f6cc2cdd2d (patch)
treefba985cc67803c80f7761462f79cf988cbf6507b /eval.c
parent59d82a928a617889c18f4da6152f11c0eb6fde06 (diff)
downloadruby-f84f4aa6b375290386c0456ac02fe8f6cc2cdd2d.tar.gz
* 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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c17
1 files changed, 15 insertions, 2 deletions
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();
}
}