diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-20 10:39:54 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-21 11:05:49 -0300 |
commit | b527ac752fd5ebcc74c06306e7009e2b98e4ee01 (patch) | |
tree | 0785b3f76cb371967ad0b28446611d1a1af60a96 /src/nvim/os/event.c | |
parent | 264e0d872c598062be2b2a118d38c89a6ed5a023 (diff) | |
download | rneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.tar.gz rneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.tar.bz2 rneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.zip |
event: Extract event_poll loops to `event_poll_until` macro
A pattern that is becoming common across the project is to poll for events until
a certain condition is true, optionally passing a timeout. To address this
scenario, the event_poll_until macro was created and the job/channel/input
modules were refactored to use it on their blocking functions.
Diffstat (limited to 'src/nvim/os/event.c')
-rw-r--r-- | src/nvim/os/event.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/os/event.c b/src/nvim/os/event.c index 00920fc5cf..2dee529452 100644 --- a/src/nvim/os/event.c +++ b/src/nvim/os/event.c @@ -27,7 +27,7 @@ KLIST_INIT(Event, Event, _destroy_event) typedef struct { bool timed_out; - int32_t ms; + int ms; uv_timer_t *timer; } TimerData; @@ -66,7 +66,7 @@ void event_teardown(void) } // Wait for some event -bool event_poll(int32_t ms) +void event_poll(int ms) { uv_run_mode run_mode = UV_RUN_ONCE; @@ -111,8 +111,6 @@ bool event_poll(int32_t ms) uv_close((uv_handle_t *)&timer_prepare, NULL); loop(UV_RUN_NOWAIT); } - - return !timer_data.timed_out && event_has_deferred(); } bool event_has_deferred(void) |