[Python-Dev] Re: Signal-resistant code (was: Two random and nearly unrelated ideas)

Jack Jansen Jack.Jansen@oratrix.com
Fri, 6 Sep 2002 17:09:16 +0200


On donderdag, september 5, 2002, at 05:01 , Guido van Rossum wrote:
>> Code in signal handlers is executed at some arbitrary point in the
>> program and the programmer should be aware of this and only do so
>> simple things like setting a flag or appending to a list.
>
> Unfortunately the mechanism doesn't enforce this.  I wish we could
> invent a Python signal API that only lets you do one of these simple
> things.

Could we connect signals to semaphores or locks or something 
like that? That would allow you to do the two things that i 
think are worth doing in a signal handler: setting a flag and/or 
making some other part of the code wake up.

Only problem is that for completeness you would really want to 
wire up select-like functionality too, so that you could really 
have a single waiting mechanism.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -