select() scheduling bug
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0d8f03a2c2
commit
9779866676
10
eval.c
10
eval.c
@ -6789,14 +6789,12 @@ rb_thread_schedule()
|
|||||||
now = -1.0;
|
now = -1.0;
|
||||||
|
|
||||||
FOREACH_THREAD_FROM(curr, th) {
|
FOREACH_THREAD_FROM(curr, th) {
|
||||||
if (!found) {
|
if (!found && th->status <= THREAD_RUNNABLE) {
|
||||||
if (th->status <= THREAD_RUNNABLE)
|
found = 1;
|
||||||
found = 1;
|
|
||||||
}
|
}
|
||||||
if (th->status != THREAD_STOPPED) continue;
|
if (th->status != THREAD_STOPPED) continue;
|
||||||
if (th->wait_for & WAIT_JOIN) {
|
if (th->wait_for & WAIT_JOIN) {
|
||||||
if (rb_thread_dead(th->join)) {
|
if (rb_thread_dead(th->join)) {
|
||||||
th->wait_for = 0;
|
|
||||||
th->status = THREAD_RUNNABLE;
|
th->status = THREAD_RUNNABLE;
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
@ -6820,7 +6818,6 @@ rb_thread_schedule()
|
|||||||
if (now < 0.0) now = timeofday();
|
if (now < 0.0) now = timeofday();
|
||||||
th_delay = th->delay - now;
|
th_delay = th->delay - now;
|
||||||
if (th_delay <= 0.0) {
|
if (th_delay <= 0.0) {
|
||||||
th->wait_for = 0;
|
|
||||||
th->status = THREAD_RUNNABLE;
|
th->status = THREAD_RUNNABLE;
|
||||||
found = 1;
|
found = 1;
|
||||||
} else if (th_delay < delay) {
|
} else if (th_delay < delay) {
|
||||||
@ -6905,7 +6902,7 @@ rb_thread_schedule()
|
|||||||
|
|
||||||
FOREACH_THREAD_FROM(curr, th) {
|
FOREACH_THREAD_FROM(curr, th) {
|
||||||
if (th->status <= THREAD_RUNNABLE) {
|
if (th->status <= THREAD_RUNNABLE) {
|
||||||
if (!next || next->priority < th->priority)
|
if (!next || next->priority < th->priority)
|
||||||
next = th;
|
next = th;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6928,6 +6925,7 @@ rb_thread_schedule()
|
|||||||
next->status = THREAD_TO_KILL;
|
next->status = THREAD_TO_KILL;
|
||||||
rb_thread_deadlock();
|
rb_thread_deadlock();
|
||||||
}
|
}
|
||||||
|
next->wait_for = 0;
|
||||||
if (next->status == THREAD_RUNNABLE && next == curr_thread) {
|
if (next->status == THREAD_RUNNABLE && next == curr_thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user