From be256c6f5a0180ac3eef05075f8b3977d29dfcb7 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 15 May 2001 08:49:23 +0000 Subject: [PATCH] * array.c (rb_ary_and): should not push frozen key string. * array.c (rb_ary_or): ditto. * eval.c (rb_thread_schedule): should save context before raising deadlock, saved context for current thread might be obsolete. * time.c (make_time_t): non DST timezone shift supported (hopefully). * signal.c: SIGINFO added. * eval.c (rb_ensure): should not SEGV when prot_tag is NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 21 +++++++++++++++++++++ array.c | 6 +++--- dln.c | 2 +- eval.c | 5 +++-- lib/thread.rb | 17 ++++++++--------- signal.c | 3 +++ time.c | 14 +++++++++++--- 7 files changed, 50 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9afa60b904..0808972a81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Tue May 15 17:46:37 2001 Yukihiro Matsumoto + + * array.c (rb_ary_and): should not push frozen key string. + + * array.c (rb_ary_or): ditto. + +Mon May 14 13:50:22 2001 Yukihiro Matsumoto + + * eval.c (rb_thread_schedule): should save context before raising + deadlock, saved context for current thread might be obsolete. + + * time.c (make_time_t): non DST timezone shift supported (hopefully). + +Mon May 14 11:54:20 2001 Tanaka Akira + + * signal.c: SIGINFO added. + +Mon May 14 08:57:06 2001 Yukihiro Matsumoto + + * eval.c (rb_ensure): should not SEGV when prot_tag is NULL. + Sun May 13 23:49:25 2001 Usaku Nakamura * win32/resource.rb: Modify copyright in resource script. diff --git a/array.c b/array.c index c0c55fa07d..e885ca5b07 100644 --- a/array.c +++ b/array.c @@ -1468,7 +1468,7 @@ rb_ary_and(ary1, ary2) for (i=0; ilen; i++) { VALUE v = RARRAY(ary1)->ptr[i]; if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, v); + rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); } } @@ -1490,13 +1490,13 @@ rb_ary_or(ary1, ary2) for (i=0; ilen; i++) { v = RARRAY(ary1)->ptr[i]; if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, v); + rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); } } for (i=0; ilen; i++) { v = RARRAY(ary2)->ptr[i]; if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, v); + rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); } } diff --git a/dln.c b/dln.c index ae3cbf2fb3..40a326df63 100644 --- a/dln.c +++ b/dln.c @@ -1204,7 +1204,7 @@ aix_loaderror(const char *pathname) if (nerr == load_errtab[i].errno && load_errtab[i].errstr) ERRBUF_APPEND(load_errtab[i].errstr); } - while (ISDIGIT(*message[i])) message[i]++; + while (isdigit(*message[i])) message[i]++; ERRBUF_APPEND(message[i]); ERRBUF_APPEND("\n"); } diff --git a/eval.c b/eval.c index f9a0bdd595..da2f1888d6 100644 --- a/eval.c +++ b/eval.c @@ -3991,9 +3991,9 @@ rb_ensure(b_proc, data1, e_proc, data2) result = (*b_proc)(data1); } POP_TAG(); - retval = prot_tag->retval; /* save retval */ + retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */ (*e_proc)(data2); - return_value(retval); + if (prot_tag) return_value(retval); if (state) JUMP_TAG(state); return result; @@ -7538,6 +7538,7 @@ rb_thread_schedule() next->gid = 0; rb_thread_ready(next); next->status = THREAD_TO_KILL; + rb_thread_save_context(curr_thread); rb_thread_deadlock(); } next->wait_for = 0; diff --git a/lib/thread.rb b/lib/thread.rb index 559cd95a8a..7b1933f6b2 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -170,7 +170,7 @@ class Queue Thread.critical = true begin loop do - if @que.length == 0 + if @que.empty? if non_block raise ThreadError, "queue empty" end @@ -184,13 +184,11 @@ class Queue Thread.critical = false end end - def shift(non_block=false) - pop(non_block) - end - alias deq shift + alias shift pop + alias deq pop def empty? - @que.length == 0 + @que.empty? end def clear @@ -223,11 +221,11 @@ class SizedQueue= @max + if max <= @max @max = max Thread.critical = false else - diff = max - @max + diff = @max - max @max = max Thread.critical = false diff.times do @@ -253,6 +251,7 @@ class SizedQueuetm_isdst || tptr->tm_hour != tm->tm_hour) { - oguess = guess - 3600; - tm = localtime(&oguess); + time_t tmp = guess - 3600; + tm = localtime(&tmp); if (!tm) goto error; if (tptr->tm_hour == tm->tm_hour) { - guess = oguess; + guess = tmp; + } + else if (lt.tm_isdst == tm->tm_isdst) { + tmp = guess + 3600; + tm = localtime(&tmp); + if (!tm) goto error; + if (tptr->tm_hour == tm->tm_hour) { + guess = tmp; + } } } if (guess < 0) {