aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event/time.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-08-13 12:20:53 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-08-13 12:20:53 -0300
commita94a68145b3c607d1e58f708ded8fe625c9973d5 (patch)
tree2d69f4f3a06f0ac5a4e936ec40bde81a26cf2b53 /src/nvim/event/time.c
parent6bf322c6ff190b9f10c5286b3ae6fceedfbddb61 (diff)
parentf1de097dbb236ea400150f80b909407ca9af7441 (diff)
downloadrneovim-a94a68145b3c607d1e58f708ded8fe625c9973d5.tar.gz
rneovim-a94a68145b3c607d1e58f708ded8fe625c9973d5.tar.bz2
rneovim-a94a68145b3c607d1e58f708ded8fe625c9973d5.zip
Merge PR #3029 'Refactor event processing architecture'
Helped-by: oni-link <knil.ino@gmail.com> Reviewed-by: oni-link <knil.ino@gmail.com>
Diffstat (limited to 'src/nvim/event/time.c')
-rw-r--r--src/nvim/event/time.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c
index ce33cdfc10..7bf333bcea 100644
--- a/src/nvim/event/time.c
+++ b/src/nvim/event/time.c
@@ -16,6 +16,7 @@ void time_watcher_init(Loop *loop, TimeWatcher *watcher, void *data)
uv_timer_init(&loop->uv, &watcher->uv);
watcher->uv.data = watcher;
watcher->data = data;
+ watcher->events = loop->fast_events;
}
void time_watcher_start(TimeWatcher *watcher, time_cb cb, uint64_t timeout,
@@ -39,11 +40,17 @@ void time_watcher_close(TimeWatcher *watcher, time_cb cb)
uv_close((uv_handle_t *)&watcher->uv, close_cb);
}
+static void time_event(void **argv)
+{
+ TimeWatcher *watcher = argv[0];
+ watcher->cb(watcher, watcher->data);
+}
+
static void time_watcher_cb(uv_timer_t *handle)
FUNC_ATTR_NONNULL_ALL
{
TimeWatcher *watcher = handle->data;
- watcher->cb(watcher, watcher->data);
+ CREATE_EVENT(watcher->events, time_event, 1, watcher);
}
static void close_cb(uv_handle_t *handle)