diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-26 07:27:37 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-26 07:27:37 +0000 |
commit | 977986667692d72b887a88facf77d0206c08ad15 (patch) | |
tree | e5edf12ddeb5088fd2a126a15893bd2b9df875eb | |
parent | 0d8f03a2c220e55909387ba04933d880c4be7323 (diff) | |
download | ruby-977986667692d72b887a88facf77d0206c08ad15.tar.gz |
select() scheduling bug
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | eval.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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; } |