unix, windows: don't treat uv_run_mode as a bitmask

The modes are not meant to be combined, and doing so may hide problems
in the future.

PR-URL: https://github.com/libuv/libuv/pull/58
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Saúl Ibarra Corretgé 2014-12-11 09:30:18 +01:00
parent fcb2223da8
commit e37a2a0d53
2 changed files with 4 additions and 5 deletions

View File

@ -317,7 +317,7 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
uv__run_prepare(loop);
timeout = 0;
if ((mode & UV_RUN_NOWAIT) == 0)
if (mode != UV_RUN_NOWAIT)
timeout = uv_backend_timeout(loop);
uv__io_poll(loop, timeout);
@ -338,8 +338,7 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
}
r = uv__loop_alive(loop);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT)
break;
}

View File

@ -407,7 +407,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
uv_prepare_invoke(loop);
timeout = 0;
if ((mode & UV_RUN_NOWAIT) == 0)
if (mode != UV_RUN_NOWAIT)
timeout = uv_backend_timeout(loop);
(*poll)(loop, timeout);
@ -428,7 +428,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
}
r = uv__loop_alive(loop);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT)
break;
}