From 977986667692d72b887a88facf77d0206c08ad15 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 26 Jun 2000 07:27:37 +0000 Subject: select() scheduling bug git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 05a1b06ca1..b5db5eac17 100644 --- a/eval.c +++ b/eval.c @@ -6789,14 +6789,12 @@ rb_thread_schedule() now = -1.0; FOREACH_THREAD_FROM(curr, th) { - if (!found) { - if (th->status <= THREAD_RUNNABLE) - found = 1; + if (!found && th->status <= THREAD_RUNNABLE) { + found = 1; } if (th->status != THREAD_STOPPED) continue; if (th->wait_for & WAIT_JOIN) { if (rb_thread_dead(th->join)) { - th->wait_for = 0; th->status = THREAD_RUNNABLE; found = 1; } @@ -6820,7 +6818,6 @@ rb_thread_schedule() if (now < 0.0) now = timeofday(); th_delay = th->delay - now; if (th_delay <= 0.0) { - th->wait_for = 0; th->status = THREAD_RUNNABLE; found = 1; } else if (th_delay < delay) { @@ -6905,7 +6902,7 @@ rb_thread_schedule() FOREACH_THREAD_FROM(curr, th) { if (th->status <= THREAD_RUNNABLE) { - if (!next || next->priority < th->priority) + if (!next || next->priority < th->priority) next = th; } } @@ -6928,6 +6925,7 @@ rb_thread_schedule() next->status = THREAD_TO_KILL; rb_thread_deadlock(); } + next->wait_for = 0; if (next->status == THREAD_RUNNABLE && next == curr_thread) { return; } -- cgit v1.2.3