signals and system calls

Donn Cave donn at drizzle.com
Wed Apr 9 22:27:51 CEST 2003


Quoth Michael Stenner <mstenner at phy.duke.edu>:

| I have a long-running python program.  I want it to terminate nicely
| (ie not lose data) upon certain common signals.  The problem comes
| with system calls.  If a system call is interruped by a signal, it
| ends up raising an exception.  Now, the way you address this in C is
| to set SA_RESTART via sigaction, but that doesn't appear the be
| available in python.  [ I trust there is a good reason, btw, and am
| curious about it, but am trying to keep this email goal-oriented :) ]

Actually I think that's the key issue.  I don't know why, either,
but I don't think there's any satisfactory substitute, so I guess
in your shoes I'd be tempted to do this in C.  That could get hairy,
since signal handling is integrated a little more intimately with
the interpreter than your average external interface, but I'm not
looking at the source as I write this, maybe it doesn't need to be
all that bad.

	Donn Cave, donn at drizzle.com




More information about the Python-list mailing list