Signals vs. system calls
Posted Nov 25, 2010 5:55 UTC (Thu) by rqosa
In reply to: Signals vs. system calls
Parent article: Ghosts of Unix past, part 3: Unfixable designs
> But that just means that a program that uses signalfd() can't fully exploit signals -- control-C won't unhang some things.
The solution to that is to use non-blocking system calls (or at least ones that you know will only block for a short time). That's something that you should already be doing if you're using signalfd(); the purpose of signalfd() is to handle signals with an event loop, and an event loop shouldn't have any blocking system calls in it (or anything else that takes a long time) except for the one select() (or epoll_wait() or similar) that drives the event loop.
(If there's some type of event whose handler must take a long time to run, then have the event loop hand it off to a worker thread/process.)
to post comments)