windows: call idle handles on every loop iteration

This mimicks what the unix implementation does: call idle handles on
every loop iteration. The guarantee that it runs on every loop iteration
makes it easier to predict and opens up more use cases.

Note that the name uv_idle is now a bit of a misnomer. There is
actually no guarantee that libuv completely processed all i/o
when an iteration ends. The windows implementation at least limits
the amount of callbacks processed in a single iteration to avoid some
handles getting a disproportionate amount of cpu attention.
This commit is contained in:
Bert Belder 2013-05-29 22:50:59 +02:00
parent c39648674c
commit bc56a4e05c

View File

@ -282,15 +282,11 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
uv_update_time(loop);
uv_process_timers(loop);
/* Call idle callbacks if nothing to do. */
if (loop->pending_reqs_tail == NULL &&
loop->endgame_handles == NULL) {
uv_idle_invoke(loop);
}
uv_process_reqs(loop);
uv_process_endgames(loop);
uv_idle_invoke(loop);
uv_prepare_invoke(loop);
(*poll)(loop, loop->idle_handles == NULL &&