From 991d3ec1e679bb6407f2a5820910d2968424183c Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 16 Jul 2015 23:10:04 -0300 Subject: event loop: New abstraction layer with refactored time/signal API - Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts. --- src/nvim/os/rstream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/os/rstream.c') diff --git a/src/nvim/os/rstream.c b/src/nvim/os/rstream.c index af84288f0f..dd91c2777e 100644 --- a/src/nvim/os/rstream.c +++ b/src/nvim/os/rstream.c @@ -120,7 +120,7 @@ void rstream_set_file(RStream *rstream, uv_file file) // in chunks of rstream->buffer_size, giving time for other events to // be processed between reads. rstream->fread_idle = xmalloc(sizeof(uv_idle_t)); - uv_idle_init(uv_default_loop(), rstream->fread_idle); + uv_idle_init(&loop.uv, rstream->fread_idle); rstream->fread_idle->data = NULL; handle_set_rstream((uv_handle_t *)rstream->fread_idle, rstream); } else { @@ -128,7 +128,7 @@ void rstream_set_file(RStream *rstream, uv_file file) assert(rstream->file_type == UV_NAMED_PIPE || rstream->file_type == UV_TTY); rstream->stream = xmalloc(sizeof(uv_pipe_t)); - uv_pipe_init(uv_default_loop(), (uv_pipe_t *)rstream->stream, 0); + uv_pipe_init(&loop.uv, (uv_pipe_t *)rstream->stream, 0); uv_pipe_open((uv_pipe_t *)rstream->stream, file); rstream->stream->data = NULL; handle_set_rstream((uv_handle_t *)rstream->stream, rstream); @@ -224,7 +224,7 @@ static void fread_idle_cb(uv_idle_t *handle) // Synchronous read uv_fs_read( - uv_default_loop(), + &loop.uv, &req, rstream->fd, &rstream->uvbuf, -- cgit