aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-04-01 08:54:31 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-01 09:46:29 -0300
commit774f668c43c14c6c6593264a1c8c9a0275b19037 (patch)
tree176395e37139e68c3a40f9271b9cfa04722c0ff1 /src/main.c
parent40879af7bdd1633f3d22f0d1da9a24992cf3e2b2 (diff)
downloadrneovim-774f668c43c14c6c6593264a1c8c9a0275b19037.tar.gz
rneovim-774f668c43c14c6c6593264a1c8c9a0275b19037.tar.bz2
rneovim-774f668c43c14c6c6593264a1c8c9a0275b19037.zip
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`
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index a8a2efbc8a..0b1f650827 100644
--- a/src/main.c
+++ b/src/main.c
@@ -47,6 +47,7 @@
#include "version.h"
#include "window.h"
#include "os/os.h"
+#include "os/signal.h"
/* Maximum number of commands from + or -c arguments. */
#define MAX_ARG_CMDS 10
@@ -2167,9 +2168,7 @@ mainerr (
char_u *str /* extra argument or NULL */
)
{
-#if defined(UNIX) || defined(__EMX__) || defined(VMS)
- reset_signals(); /* kill us with CTRL-C here, if you like */
-#endif
+ signal_stop(); /* kill us with CTRL-C here, if you like */
mch_errmsg(longVersion);
mch_errmsg("\n");
@@ -2214,9 +2213,7 @@ static void usage(void)
N_("-q [errorfile] edit file with first error")
};
-#if defined(UNIX) || defined(__EMX__) || defined(VMS)
- reset_signals(); /* kill us with CTRL-C here, if you like */
-#endif
+ signal_stop(); /* kill us with CTRL-C here, if you like */
mch_msg(longVersion);
mch_msg(_("\n\nusage:"));