diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-13 11:27:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 11:27:04 +0800 |
commit | 93c93a0e3646a205013f439013e22d674b224cdb (patch) | |
tree | 80fb47f340680b961127f5e1d6d0338046203c81 | |
parent | 9f59415243adcf70c02bc056ed755859456b20e8 (diff) | |
download | rneovim-93c93a0e3646a205013f439013e22d674b224cdb.tar.gz rneovim-93c93a0e3646a205013f439013e22d674b224cdb.tar.bz2 rneovim-93c93a0e3646a205013f439013e22d674b224cdb.zip |
refactor: remove "once" argument of loop_uv_run() (#27841)
It is always set to true when used, and makes the code a bit confusing.
-rw-r--r-- | src/nvim/event/loop.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index 93948d3eaa..e1ebcecbd6 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -39,10 +39,8 @@ void loop_init(Loop *loop, void *data) /// @param ms 0: non-blocking poll. /// > 0: timeout after `ms`. /// < 0: wait forever. -/// @param once true: process at most one `Loop.uv` event. -/// false: process until `ms` timeout (only has effect if `ms` > 0). /// @return true if `ms` > 0 and was reached -bool loop_uv_run(Loop *loop, int64_t ms, bool once) +static bool loop_uv_run(Loop *loop, int64_t ms) { if (loop->recursive++) { abort(); // Should not re-enter uv_run @@ -60,9 +58,7 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once) mode = UV_RUN_NOWAIT; } - do { - uv_run(&loop->uv, mode); - } while (ms > 0 && !once && !*timeout_expired); + uv_run(&loop->uv, mode); if (ms > 0) { uv_timer_stop(&loop->poll_timer); @@ -83,7 +79,7 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once) /// @return true if `ms` > 0 and was reached bool loop_poll_events(Loop *loop, int64_t ms) { - bool timeout_expired = loop_uv_run(loop, ms, true); + bool timeout_expired = loop_uv_run(loop, ms); multiqueue_process_events(loop->fast_events); return timeout_expired; } |