LWN.net Logo

Signals vs. system calls

Signals vs. system calls

Posted Nov 25, 2010 5:55 UTC (Thu) by rqosa (subscriber, #24136)
In reply to: Signals vs. system calls by giraffedata
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.)


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds