3 ms·
It isn't POSIX, but Linux does have the very useful signalfd, which creates a file descriptor that accepts signals. This is a good solution for some types of p
by Skunkleton 10y ago
It isn't POSIX, but Linux does have the very useful signalfd, which creates a file descriptor that accepts signals. This is a good solution for some types of programs.
- SFJulie 10y agoBut as pointed in this old HN story it is useless in this case. https://news.ycombinator.com/item?id=9564975 https://news.ycombinator.com/item?id=9564975
- Skunkleton 10y agoIt is an easy solution to the problem discussed above though. Yeah, all the mechanics of setting up your signals still are a PITA, but at least you don't have to worry about async-safe functions anymore. Really all signalfd does is provide an easy way to handle signals in an epoll driven application. If you have a different kind of main loop, then you are probably back to stuffing messages into queues, or dealing with all of the async-safe BS.