summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-11 10:03:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-11 10:03:21 +0000
commit1bc6f594d3de8dbfb5c165835eaec99bd49327c8 (patch)
treed535a84c63a5cf779aa1ae83f89ed64f22040471 /eval.c
parent3f5b1ec9cb657375a0c467ac70fdd6fbdc97f018 (diff)
1.1b9_25
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c51
1 files changed, 45 insertions, 6 deletions
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