From 2cafd39ed2bd164ece3468393300684f2da19902 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 29 Dec 2000 02:46:12 +0000 Subject: thread_critical bug reported by Dave - matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 3 +-- eval.c | 13 +++++++++---- ext/sdbm/_sdbm.c | 4 +--- range.c | 1 + version.h | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/array.c b/array.c index 638b392753..9872c460e0 100644 --- a/array.c +++ b/array.c @@ -1355,8 +1355,7 @@ rb_ary_eql(ary1, ary2) long i; if (TYPE(ary2) != T_ARRAY) return Qfalse; - if (RARRAY(ary1)->len != RARRAY(ary2)->len) - return Qfalse; + if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; for (i=0; ilen; i++) { if (!rb_eql(RARRAY(ary1)->ptr[i], RARRAY(ary2)->ptr[i])) return Qfalse; diff --git a/eval.c b/eval.c index c7e88cab7d..75f1c02cb6 100644 --- a/eval.c +++ b/eval.c @@ -7354,6 +7354,7 @@ void rb_thread_wait_fd(fd) int fd; { + if (rb_thread_critical) return; if (curr_thread == curr_thread->next) return; if (curr_thread->status == THREAD_TO_KILL) return; @@ -7367,6 +7368,7 @@ int rb_thread_fd_writable(fd) int fd; { + if (rb_thread_critical) return Qtrue; if (curr_thread == curr_thread->next) return Qtrue; if (curr_thread->status == THREAD_TO_KILL) return Qtrue; @@ -7387,7 +7389,8 @@ rb_thread_wait_for(time) { double date; - if (curr_thread == curr_thread->next || + if (rb_thread_critical || + curr_thread == curr_thread->next || curr_thread->status == THREAD_TO_KILL) { int n; #ifndef linux @@ -7452,7 +7455,8 @@ rb_thread_select(max, read, write, except, timeout) (double)timeout->tv_sec+(double)timeout->tv_usec*1e-6; } - if (curr_thread == curr_thread->next || + if (rb_thread_critical || + curr_thread == curr_thread->next || curr_thread->status == THREAD_TO_KILL) { #ifndef linux struct timeval tv, *tvp = timeout; @@ -7518,6 +7522,7 @@ rb_thread_join(thread) rb_thread_t th = rb_thread_check(thread); enum thread_status last_status = THREAD_RUNNABLE; + if (rb_thread_critical) rb_thread_deadlock(); if (!rb_thread_dead(th)) { if (th == curr_thread) rb_raise(rb_eThreadError, "thread tried to join itself"); @@ -7617,8 +7622,8 @@ rb_thread_kill(thread) rb_thread_ready(th); th->gid = 0; th->status = THREAD_TO_KILL; - rb_thread_schedule(); - return Qnil; /* not reached */ + if (!rb_thread_critical) rb_thread_schedule(); + return thread; } static VALUE diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c index 7a31472930..92c96f26d0 100644 --- a/ext/sdbm/_sdbm.c +++ b/ext/sdbm/_sdbm.c @@ -103,11 +103,9 @@ static int duppair proto((char *, datum)); /* * externals */ -#ifndef sun -#ifndef MSDOS +#if !defined(sun) && !defined(MSDOS) && !defined(_WIN32) extern int errno; #endif -#endif /* * forward diff --git a/range.c b/range.c index cd9750428c..68229b7696 100644 --- a/range.c +++ b/range.c @@ -90,6 +90,7 @@ static VALUE range_eq(range, obj) VALUE range, obj; { + if (range == obj) return Qtrue; if (!rb_obj_is_kind_of(obj, rb_cRange)) return Qfalse; if (!rb_equal(rb_ivar_get(range, id_beg), rb_ivar_get(obj, id_beg))) diff --git a/version.h b/version.h index 5d1bd51c61..2b892a328a 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.0" -#define RUBY_RELEASE_DATE "2000-12-26" +#define RUBY_RELEASE_DATE "2000-12-29" #define RUBY_VERSION_CODE 170 -#define RUBY_RELEASE_CODE 20001226 +#define RUBY_RELEASE_CODE 20001229 -- cgit v1.2.3