News for hackers. Stuff that matters.
Re:Linux: What Can You Epoll? by tlsalmin on Saturday October 22, 2022 @05:45PM (#33302502)
I have to disagree here. Not recommending signalfd for the mentioned use cases might be reasonable, just as reasonable as it is to use threads for a specific use case. For a single threaded non-blocking-FD using client/server signalfd removes the risk of doing too much in the signal handler and brings signals nicely into the event loop. This just happens to be 99% of the functionality I have to do.

I'd only use more than one signalfd if each signalfd only catches a specific signal. E.g. main context handles Sigterm and a background process library handles sigchld.

Re:Linux: What Can You Epoll? by kentonv on Saturday October 22, 2022 @07:37PM (#33303217)
> removes the risk of doing too much in the signal handler

Not a concern here, since the signal handler is restricted from running at any time other than during epoll_pwait(), so the usual async-signal-safety concerns don't apply. In fact I think the code ends up cleaner than with signalfd, and there are fewer syscalls (no separate read() needed).

Re:Linux: What Can You Epoll? by tlsalmin on Sunday October 23, 2022 @02:17AM (#33304984)
This is getting into taste territory but sure just getting the signal in epoll_pwait removes the need for FD reading. But introduces the need for the thread local global context and the need to handle EINTR from epoll right? I can see how checking if signals were called in the EINTR-branch is nice though.

Anyway nice to know the p-version use case.