mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* 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
This commit is contained in:
parent
d54accfe3f
commit
662e3cf1f9
11 changed files with 111 additions and 46 deletions
12
eval.c
12
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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue