News for hackers. Stuff that matters.
Re:Linux: What Can You Epoll? by cryptonector on Saturday October 22, 2022 @11:54PM (#33304441)
Using a self-pipe (signal handler writes one byte to one end, the other end is used in your event loop) is the most portable and reliable way to handle signals.
Re:Linux: What Can You Epoll? by kentonv on Sunday October 23, 2022 @02:34PM (#33309093)
Yeah but it involves several extra syscalls, two file descriptors, and a kernel buffer that never has any actual data in it...

poll() + longjmp() out of the signal handler is actually surprisingly portable and much more efficient (but breaks all sorts of abstractions in ways that terrify people).

Re:Linux: What Can You Epoll? by cryptonector on Monday October 24, 2022 @12:53PM (#33319171)
The overhead is very limited. The memory overhead is fixed, and the compute overhead is linear with the rate at which signals arrive (which is typically super low). Plus the whole thing is very easy to reason about. And you never have to worry about masking signals that you handle with a self-pipe. Add in the portability, and it's a very clear win.