From 1bc6f594d3de8dbfb5c165835eaec99bd49327c8 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 11 Jun 1998 10:03:21 +0000 Subject: 1.1b9_25 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 6f287b9b81..aa83d7533e 100644 --- a/eval.c +++ b/eval.c @@ -450,6 +450,17 @@ new_dvar(id, value) vars->id = id; vars->val = value; vars->next = the_dyna_vars; + + return vars; +} + +static struct RVarmap* +push_dvar(id, value) + ID id; + VALUE value; +{ + struct RVarmap* vars = new_dvar(id, value); + if (the_dyna_vars) { vars->next = the_dyna_vars->next; the_dyna_vars->next = vars; @@ -491,21 +502,42 @@ dyna_var_ref(id) return Qnil; } -VALUE -dyna_var_asgn(id, value) +static void +dvar_add_compiling(id) ID id; - VALUE value; { struct RVarmap *vars = the_dyna_vars; while (vars) { + if (vars->id == 0) break; if (vars->id == id) { - vars->val = value; - return value; + return; } vars = vars->next; } - new_dvar(id, value); + the_dyna_vars = new_dvar(id, 0); +} + +VALUE +dyna_var_asgn(id, value) + ID id; + VALUE value; +{ + if (id == 0) { + dvar_add_compiling((ID)value); + } + else { + struct RVarmap *vars = the_dyna_vars; + + while (vars) { + if (vars->id == id) { + vars->val = value; + return value; + } + vars = vars->next; + } + push_dvar(id, value); + } return value; } @@ -6159,8 +6191,10 @@ thread_create(fn, arg) #ifdef POSIX_SIGNAL posix_signal(SIGVTALRM, catch_timer); + posix_signal(SIGALRM, catch_timer); #else signal(SIGVTALRM, catch_timer); + posix_signal(SIGALRM, catch_timer); #endif tval.it_interval.tv_sec = 0; @@ -6168,6 +6202,11 @@ thread_create(fn, arg) tval.it_value = tval.it_interval; setitimer(ITIMER_VIRTUAL, &tval, NULL); + tval.it_interval.tv_sec = 2; /* unblock system calls */ + tval.it_interval.tv_usec = 0; + tval.it_value = tval.it_interval; + setitimer(ITIMER_REAL, &tval, NULL); + init = 1; } #endif -- cgit v1.2.3