How do I modify global variables from a signal handler?
Brian Quinlan
brian at sweetapp.com
Sat May 11 00:04:40 EDT 2002
> This behavior isn't very surprising given the nature of signals
> and the fun state they can leave the stack.
> I assume that I have to do something with frame in the signal handler,
> but the use of frame is not documented -- nor is the use of
> Frame Objects as far as I can tell.
You are looking to deep. You just have to declare the use of global
variables:
GLOBAL_SIGCHLD_RECEIVED = 0
def childdied (signum, frame):
+ global GLOBAL_SIGCHLD_RECEIVED
print 'Signal handler called with signal', signum
GLOBAL_SIGCHLD_RECEIVED = 1
Cheers,
Brian
More information about the Python-list
mailing list