[Twisted-Python] signalfd

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Nov 3 22:23:38 EDT 2010

On 01:45 am, ndbecker2 at gmail.com wrote:
>On modern linux, signalfd can be used to convert sigchld into an event 
>on a
>file descriptor.  Looks like just what is wanted for processProtocol.

It does, indeed.  I'm not sure it's really worth bothering though.  Here 
are the drawbacks of using signalfd():

   - It only works on Linux
   - It works differently on older versions of Linux than on newer 
   - You still can't have another SIGCHLD handler installed that will 
called (so it's not any more cooperative with other library code)

As compared to using SA_RESTART with a normal SIGCHLD handler, this is 
two extra drawbacks.  The advantages of signalfd() are:

    - It's just another fd, so the reactor doesn't need as much special 
support code

But this advantage is negated by the fact that we still need the special 
support code for older versions of Linux and for other platforms.

If anyone's aware of other advantages or drawbacks of one approach or 
the other, it would be interesting to hear about them.  Otherwise, it 
doesn't seem like it's worth changing.

Thanks for the suggestion! :)


More information about the Twisted-Python mailing list