[Python-Dev] Signals, threads, blocking C functions

Nick Maclaren nmm1 at cus.cam.ac.uk
Tue Sep 5 15:53:45 CEST 2006

"Gustavo Carneiro" <gjcarneiro at gmail.com> wrote:
> Anyway, I was speaking hypothetically.  I'm pretty sure writing to a
> pipe is async signal safe.  It is the oldest trick in the book,
> everyone uses it.  I don't have to see a written signed contract to
> know that it works.

Ah.  Well, I can assure you that it's not the oldest trick in the book,
and not everyone uses it.

> This is all the evidence that I need.  And again I reiterate that
> whether or not async safety can be achieved in practice for all
> platforms is not Python's problem.

I wish you the joy of trying to report a case where it doesn't work
to a large vendor and get them to accept that it is a bug.

> Although I believe writing to a
> pipe is 100% reliable for most platforms.  Even if it is not, any
> mission critical application relying on signals for correct behaviour
> should be rewritten to use unix sockets instead; end of argument.

Er, no.  There are lots of circumstances where that isn't feasible,
such as wanting to close down an application cleanly when the scheduler
sends it a SIGXCPU.

Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

More information about the Python-Dev mailing list