[mod_python] execution time limit

Mark Harrison mh at pixar.com
Fri Jan 12 14:38:41 EST 2007


Graham Dumpleton wrote:
> Send this back to the mailing list. I have no idea how PHP does it.

Something like this might work:

import signal

def myalarm(signo, stackframe):
    ...


def handler(req):
     signal.alarm(10) # schedule a sigalarm in 10 seconds
     signal.signal(signal.SIGALRM, myalarm)
     do_stuff()
     signal.alarm(0)  # cancel the alarm


More information about the Mod_python mailing list