From 774f668c43c14c6c6593264a1c8c9a0275b19037 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 1 Apr 2014 08:54:31 -0300 Subject: Move signal handling to libuv event loop This removes all signal handling code from os_unix.c to os/signal.c. Now signal handling is done like this: - Watchers for signals are registered with libuv default event loop - `event_poll` continuously calls `poll_uv_loop` to produce events until it receives user input, SIGINT or a timeout - Any signals received in `poll_uv_loop` will push events to a queue that is drained and processed by `event_poll` Signals aren't handled directly in the libuv callback to avoid recursion in the event loop(which isn't supported by libuv). The same principle will apply to other events in the future: Push to a queue from a libuv callback and drain it from `event_poll` --- src/os/signal.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/os/signal.h (limited to 'src/os/signal.h') diff --git a/src/os/signal.h b/src/os/signal.h new file mode 100644 index 0000000000..a5247742db --- /dev/null +++ b/src/os/signal.h @@ -0,0 +1,13 @@ +#ifndef NEOVIM_OS_SIGNAL_H +#define NEOVIM_OS_SIGNAL_H + +#include "os/event.h" + +void signal_init(void); +void signal_stop(void); +void signal_accept_deadly(void); +void signal_reject_deadly(void); +void signal_handle(Event *event); + +#endif + -- cgit