summaryrefslogtreecommitdiffstats
path: root/src/recite
diff options
context:
space:
mode:
authorRory Dudley2024-02-24 21:24:19 -0700
committerRory Dudley2024-02-24 21:24:19 -0700
commitb6fc81066cfcc29d4519191eae5ba19581ad2774 (patch)
treeb11eb5bd076e672812f94ba8578e80769c02f86f /src/recite
parent536e250653e5c140a6d9e60f1cd652b79135e7a6 (diff)
downloaddwarvish-signal.tar.gz
Replace ctrlc with signal-hooksignal
Replaced the 'ctrlc' crate with 'signal-hook' for handling of SIGINT. The 'signal_hook::low_level::register' function is actually unsafe. However, according to https://docs.rs/signal-hook/latest/signal_hook/low_level/fn.register.html, it is only unsafe in the case of multithreaded applications. There are some race conditions as well. For instance, it appears that even when we fork to a child process, SIGINT is captured on both that process, as well as the shell.
Notes
Notes: The replacement was motivated by the fact that 'ctrlc' appears to use a separate thread to handle interrupts. This is evident if you run: ps aux | grep dwvsh USER PID %CPU %MEM VSZ RSS TTY STAT START COMMAND user pid 0.0 0.0 71500 3072 term Sl+ 20:08 target/debug/dwvsh Further reading in 'man ps' under 'PROCESS STATE CODES', reveals that 'l' is a process state referring to multithreaded applications. Given the nature of interupts, this seems unnecessary. The issue where SIGINT is captured by both the shell, and child process will have to be addressed.
Diffstat (limited to 'src/recite')
0 files changed, 0 insertions, 0 deletions