[Python-Dev] Signals, threads, blocking C functions
rhamph at gmail.com
Tue Sep 12 07:05:00 CEST 2006
On 9/11/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Gustavo Carneiro wrote:
> > The only potential problem left is that, by changing the pipe file
> > descriptor to non-blocking mode we can only write as many bytes to it
> > without reading from the other side as the pipe buffer allows. If a
> > large number of signals arrive very quickly, that buffer may fill and
> > we lose signals.
> That might be an argument for *not* trying to
> communicate the signal number by the value
> written to the pipe, but keep a separate set
> of signal-pending flags, and just use the pipe
> as a way of indicating that *something* has
That brings you back to how you access the flags variable. At best it
is very difficult, requiring unique assembly code for every supported
platform. At worst, some platforms may not have any way to do it from
an interrupt context..
A possible alternative is to keep a set of flags for every thread, but
that requires the threads poll their variable regularly, and possibly
a wake-up pipe for each thread..
Adam Olsen, aka Rhamphoryncus
More information about the Python-Dev