[Python-Dev] Signals+Threads (PyGTK waking up 10x/sec).

Guido van Rossum guido at python.org
Sun Dec 9 02:54:31 CET 2007


On Dec 8, 2007 5:30 PM, Adam Olsen <rhamph at gmail.com> wrote:
> On Dec 8, 2007 5:21 PM, Guido van Rossum <guido at python.org> wrote:
> > Hm... Does this mean you're *always* creating an extra thread to handle signals?
>
> Yup, Py_Initialize will do it.

That's unacceptable. It must be possible to build Python without
threads (and still support signals -- in fact one could argue that
signals make *more* sense when there are no threads :-).

[...]

> To summarize, there's two problems to be solved:
> 1) low-level corruption in the signal handlers as they record a new
> signal, such as in Py_AddPendingCalls

This is purely theoretical, right? Has anyone ever observed this?

> 2) high-level wakeup race: "check for pending signals, have a signal
> come in, then call a blocking syscall/library (oblivious to the new
> signal)."

Right. That's the race which really does happen, and for which the
current lame-y work-around is to use a short timeout.

[...]

> > Anyway, I would still like to discuss this on #python-dev Monday.
> > Adam, in what time zone are you? (I'm PST.) Who else is interested?
>
> MST.

Unfortunately I can't stay at work later than 5:30 or so which would
be too early for you I believe. I could try again after 8pm, your 9pm.
Would that work at all? Otherwise I'd rather try earlier in the day if
that works at all for you.


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list