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

glyph at divmod.com glyph at divmod.com
Fri Dec 7 22:35:19 CET 2007


On 02:48 pm, gjcarneiro at gmail.com wrote:
>Not only that, but current python signal handling is not theorethically
>async safe; there are race conditions in the Py_AddPendingCalls API, 
>and it
>just happens to work most of the time.

Twisted has encountered one such issue, described here:

    http://twistedmatrix.com/trac/ticket/1997#comment:12

Unfortunately, I don't know enough about signals to suggest or comment 
on the solution.  Any Python/C wrapper around a syscall which can be 
interrupted needs to somehow atomically check for the presence of 
pending python signal handlers; I don't know of any POSIX API to do 
that.


More information about the Python-Dev mailing list