diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2019-06-18 00:00:51 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-27 21:19:10 +0200 |
| commit | 21f0f7bca5a13fe847478ef27dc26bced9b3f3d1 (patch) | |
| tree | 72f91c7794869206527eaa9497671a79aab1d3d8 /src/nvim/event | |
| parent | a851090dec8600b38d54cd65264e4146ad02b1e0 (diff) | |
| download | rneovim-21f0f7bca5a13fe847478ef27dc26bced9b3f3d1.tar.gz rneovim-21f0f7bca5a13fe847478ef27dc26bced9b3f3d1.tar.bz2 rneovim-21f0f7bca5a13fe847478ef27dc26bced9b3f3d1.zip | |
paste: WIP #4448
Diffstat (limited to 'src/nvim/event')
| -rw-r--r-- | src/nvim/event/loop.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index 609c723c57..93ec28bb81 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -36,6 +36,10 @@ void loop_init(Loop *loop, void *data) /// Processes all `Loop.fast_events` events. /// Does NOT process `Loop.events`, that is an application-specific decision. /// +/// @param loop +/// @param ms 0: non-blocking poll. +/// >0: timeout after `ms`. +/// <0: wait forever. /// @returns true if `ms` timeout was reached bool loop_poll_events(Loop *loop, int ms) { @@ -104,10 +108,10 @@ static void loop_deferred_event(void **argv) void loop_on_put(MultiQueue *queue, void *data) { Loop *loop = data; - // Sometimes libuv will run pending callbacks(timer for example) before + // Sometimes libuv will run pending callbacks (timer for example) before // blocking for a poll. If this happens and the callback pushes a event to one // of the queues, the event would only be processed after the poll - // returns(user hits a key for example). To avoid this scenario, we call + // returns (user hits a key for example). To avoid this scenario, we call // uv_stop when a event is enqueued. uv_stop(&loop->uv); } @@ -162,6 +166,7 @@ static void async_cb(uv_async_t *handle) { Loop *l = handle->loop->data; uv_mutex_lock(&l->mutex); + // Flush thread_events to fast_events for processing on main loop. while (!multiqueue_empty(l->thread_events)) { Event ev = multiqueue_get(l->thread_events); multiqueue_put_event(l->fast_events, ev); |