summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-12-27 17:06:53 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-12-27 17:06:53 +0100
commit60283fb1407fcd1de0586c960ed8d106f59483e9 (patch)
tree306d3daa5c409b0449b4151fa8939f88ddc84884 /src/server/interruption.c
parent4a9df9b604cec6ee4b4a6f01ef940443583f7573 (diff)
Got a clue about the pesky "SYN" messages.
I must not have read libevdev's documentation well enough. Hopefully this new approach will work better. The risk would be that the conversion takes too long and properly handling all events leads to an increasing lag between the physical and the virtual device. I should probably add an option to let users indicate they would prefer dropping missed events.
Diffstat (limited to 'src/server/interruption.c')
-rw-r--r--src/server/interruption.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server/interruption.c b/src/server/interruption.c
new file mode 100644
index 0000000..6eb7827
--- /dev/null
+++ b/src/server/interruption.c
@@ -0,0 +1,23 @@
+static int RELABSD_RUN = 1;
+
+static void interrupt (int unused_mandatory_parameter)
+{
+ RELABSD_RUN = 0;
+
+ RELABSD_S_WARNING("Interrupted, will exit at the next input device event.");
+}
+
+static int set_signal_handlers ()
+{
+ RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Setting signal handlers.");
+
+ if (signal(SIGINT, interrupt) == SIG_ERR)
+ {
+ RELABSD_S_FATAL("Unable to set the SIGINT signal handler.");
+
+ return -1;
+ }
+
+ return 0;
+}
+