summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index e54cf21da5..9cf2eb3759 100644
--- a/eval.c
+++ b/eval.c
@@ -7614,6 +7614,9 @@ rb_thread_schedule()
copy_fds(&exceptfds, &th->exceptfds, th->fd);
if (max < th->fd) max = th->fd;
need_select = 1;
+ if (th->wait_for & WAIT_TIME) {
+ need_select = 2;
+ }
th->select_value = 0;
}
if (th->wait_for & WAIT_TIME) {
@@ -7673,6 +7676,18 @@ rb_thread_schedule()
}
END_FOREACH_FROM(curr, th);
}
+ if (n == 0 && need_select == 2) {
+ if (now < 0.0) now = timeofday();
+ FOREACH_THREAD_FROM(curr, th) {
+ if ((th->wait_for & (WAIT_SELECT|WAIT_TIME)) && th->delay < now) {
+ th->status = THREAD_RUNNABLE;
+ th->wait_for = 0;
+ th->select_value = 0;
+ found = 1;
+ }
+ }
+ END_FOREACH_FROM(curr, th);
+ }
if (n > 0) {
now = -1.0;
/* Some descriptors are ready.