aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-11-03 15:41:54 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-11-03 21:51:51 -0300
commit636fc6b08d05a55e24a7e7fc7df48d9563e085a2 (patch)
treee7b7dea75ee26eac26c9e05cd046e2b32162f0d2
parent74b9f33a95b57eeafbec39796c72c3be48b83f78 (diff)
downloadrneovim-636fc6b08d05a55e24a7e7fc7df48d9563e085a2.tar.gz
rneovim-636fc6b08d05a55e24a7e7fc7df48d9563e085a2.tar.bz2
rneovim-636fc6b08d05a55e24a7e7fc7df48d9563e085a2.zip
channel: Move mch_exit(0) call to a non-deferred event handler
Since `mch_exit` will re-enter event_poll, it is necessary to call it outside libuv event loop.
-rw-r--r--src/nvim/msgpack_rpc/channel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 10d180b3b7..c2d16d170f 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -600,11 +600,16 @@ static void close_channel(Channel *channel)
if (handle) {
uv_close(handle, close_cb);
} else {
- mch_exit(0);
+ event_push((Event) { .handler = on_stdio_close }, false);
}
}
}
+static void on_stdio_close(Event e)
+{
+ mch_exit(0);
+}
+
static void free_channel(Channel *channel)
{
pmap_del(uint64_t)(channels, channel->id);