[Python-Dev] Re: Signal-resistant code (was: Two random and nearly
unrelated ideas)
Neal Norwitz
neal@metaslash.com
Fri, 06 Sep 2002 11:36:40 -0400
Guido van Rossum wrote:
>
> > 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.
>
> But that mixes signals with threads, which is even more poorly
> standardized than signals in general.
Python can open a pipe to itself. When a signal arrives, write
a character on the pipe in addition to setting a flag.
Then select() on the pipe.
I doubt this is worth the effort, though.
Neal