diff options
| author | spv <spv@spv.sh> | 2025-09-21 00:59:56 -0400 |
|---|---|---|
| committer | spv <spv@spv.sh> | 2025-09-21 00:59:56 -0400 |
| commit | 02a74cc0b499f6a93c25ea8cd392af977298d60a (patch) | |
| tree | 71b9008bdb6402e10477c9f80fe43950f7c89c72 /src/keypress_thread.c | |
| parent | 38d25483657e82eb546ecb8566214f830efba461 (diff) | |
use signal ipc instead of sleep loop
Diffstat (limited to 'src/keypress_thread.c')
| -rw-r--r-- | src/keypress_thread.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); |
