How do I modify global variables from a signal handler?
Noah
noah at noah.org
Sat May 11 02:14:26 EDT 2002
Oh, duh...
-----Original Message-----
From: Brian Quinlan [mailto:brian at sweetapp.com]
Sent: Friday, May 10, 2002 9:05 PM
To: 'Noah'; python-list at python.org
Subject: RE: How do I modify global variables from a signal handler?
> 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