[Twisted-Python] signalfd

Neal Becker ndbecker2 at gmail.com
Wed Nov 3 19:45:39 MDT 2010


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.

There is also a python interface here:
https://launchpad.net/python-signalfd/+download

This test seems to work for me:

import signalfd
import signal
import subprocess
import select

signalfd.sigprocmask (signalfd.SIG_BLOCK, [signal.SIGCHLD])
fd = signalfd.signalfd (-1, [signal.SIGCHLD])

child = subprocess.Popen (['sleep', '5'])
while True:
    a,b,c, = select.select ([fd], [], [])
    print 'a:', a, 'b:', b, 'c:', c
    if child.poll() != None:
        break





More information about the Twisted-Python mailing list