summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-09 22:28:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-09 22:28:42 +0000
commit662e3cf1f94bb50f6a27568c7526f867956e5b55 (patch)
treec2aa80d7fdd9598fcd612e59d6373f97b893dc21 /eval.c
parentd54accfe3ff3fd8a139cc7b899fc1e20104dcc97 (diff)
* eval.c (rb_load): put rb_load_file() in a thread critical
section. [ruby-dev:20490] * eval.c (compile): put rb_compile_string() in a thread critical section. * variable.c (rb_const_get_0): should not warn if constant is not defined. (ruby-bugs-ja PR#509) * bignum.c (rb_big2dbl): give a warning on overflow. (ruby-bugs-ja PR#510) * util.c (ruby_strtod): change MDMAXEXPT from 511 to 308. * pack.c (utf8_to_uv): long is sufficient. LONG_LONG is not required. * bignum.c (rb_big2str): support 32 bit (without `long long' type) machines. (ruby-bugs-ja PR#512) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 605d4f8..47853d6 100644
--- a/eval.c
+++ b/eval.c
@@ -5339,10 +5339,15 @@ compile(src, file, line)
int line;
{
NODE *node;
+ int critical;
ruby_nerrs = 0;
StringValue(src);
+ critical = rb_thread_critical;
+ rb_thread_critical = Qtrue;
node = rb_compile_string(file, src, line);
+ rb_thread_critical = critical;
+
if (ruby_nerrs == 0) return node;
return 0;
@@ -5747,17 +5752,22 @@ rb_load(fname, wrap)
last_func = ruby_frame->last_func;
if (state == 0) {
NODE *node;
+ volatile int critical;
DEFER_INTS;
ruby_in_eval++;
+ critical = rb_thread_critical;
+ rb_thread_critical = Qtrue;
rb_load_file(RSTRING(fname)->ptr);
ruby_in_eval--;
node = ruby_eval_tree;
ALLOW_INTS;
+ rb_thread_critical = critical;
if (ruby_nerrs == 0) {
eval_node(self, node);
}
}
+ ALLOW_INTS;
ruby_frame->last_func = last_func;
if (ruby_scope->flags == SCOPE_ALLOCA && ruby_class == rb_cObject) {
if (ruby_scope->local_tbl) /* toplevel was empty */
@@ -8440,6 +8450,7 @@ rb_thread_schedule()
rb_thread_t curr;
int found = 0;
+ if (ruby_in_compile) abort();
fd_set readfds;
fd_set writefds;
fd_set exceptfds;
@@ -8680,6 +8691,7 @@ rb_thread_wait_fd(fd)
int fd;
{
if (rb_thread_critical) return;
+ if (ruby_in_compile) return;
if (curr_thread == curr_thread->next) return;
if (curr_thread->status == THREAD_TO_KILL) return;