Description
Signal Handlers (and interrupt handlers, which are basically equivalent) are a fun thing to specify.
Signal Handlers have been modeled as separate threads, but this is incorrect: Because the code that is interrupted is running on the same thread, you cannot, e.g. acquire a mutex, or perform I/O from a signal handler. (C, C++, and POSIX each individually maintain a more comprehensive list of what you can and cannot do: https://en.cppreference.com/w/cpp/utility/program/signal, https://en.cppreference.com/w/c/program/signal, https://man7.org/linux/man-pages/man7/signal-safety.7.html).
Some things that are clear, at least to me:
- non-
mut
,impl Freeze
statics should be accessible and yield proper values when read, - non-
mut
statics withAtomic*
types should be accessible and be usable as normal, - You can call any function that C allows you to call in a signal handlers.
Note: This question only tracks asynchronous signals and asynchronous interrupts. I'd assume the answer to "What can a signal caused by raise
do" is "Anything raise
could do if it was an arbitrary opaque function".
Further sub-questions: