c-signal-handler-safety
Installation
SKILL.md
C Signal Handler Safety
When to use
- Installing a handler with
signal()orsigaction()— SIGINT/SIGTERM shutdown, "set a flag" patterns, watchdog or crash handlers. - Code that calls
write/_writeor sets a flag from a handler, or defers work to a main loop after a signal. - Debugging a program that hangs, crashes, or drops data only after Ctrl+C or
kill— the classic signal-vs-malloc/stdio deadlock. - Reviewing C that intersects with
c-errno-and-syscall-returns(EINTR is caused by signals; interrupted syscalls must be retried there).