From 02a74cc0b499f6a93c25ea8cd392af977298d60a Mon Sep 17 00:00:00 2001 From: spv Date: Sun, 21 Sep 2025 00:59:56 -0400 Subject: use signal ipc instead of sleep loop --- src/keypress_thread.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/keypress_thread.c') diff --git a/src/keypress_thread.c b/src/keypress_thread.c index 47fb1de..a174968 100644 --- a/src/keypress_thread.c +++ b/src/keypress_thread.c @@ -5,13 +5,19 @@ #include "common.h" +static pid_t light_pid; + void on_press(void) { gettimeofday(last_press, NULL); + kill(light_pid, SIGCONT); + // XXX signal light thread } -int keypress_thread(void) { +int keypress_thread(pid_t _light_pid) { + light_pid = _light_pid; + FILE* fp = fopen(KEYBOARD_FILE, "r"); fseek(fp, 0, SEEK_END); -- cgit v1.2.3