mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: remove "once" argument of loop_uv_run() (#27841)
It is always set to true when used, and makes the code a bit confusing.
This commit is contained in:
parent
9f59415243
commit
93c93a0e36
@ -39,10 +39,8 @@ void loop_init(Loop *loop, void *data)
|
|||||||
/// @param ms 0: non-blocking poll.
|
/// @param ms 0: non-blocking poll.
|
||||||
/// > 0: timeout after `ms`.
|
/// > 0: timeout after `ms`.
|
||||||
/// < 0: wait forever.
|
/// < 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
|
/// @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++) {
|
if (loop->recursive++) {
|
||||||
abort(); // Should not re-enter uv_run
|
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;
|
mode = UV_RUN_NOWAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
uv_run(&loop->uv, mode);
|
||||||
uv_run(&loop->uv, mode);
|
|
||||||
} while (ms > 0 && !once && !*timeout_expired);
|
|
||||||
|
|
||||||
if (ms > 0) {
|
if (ms > 0) {
|
||||||
uv_timer_stop(&loop->poll_timer);
|
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
|
/// @return true if `ms` > 0 and was reached
|
||||||
bool loop_poll_events(Loop *loop, int64_t ms)
|
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);
|
multiqueue_process_events(loop->fast_events);
|
||||||
return timeout_expired;
|
return timeout_expired;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user