signals and system calls

Peter Hansen peter at engcorp.com
Wed Apr 9 20:40:11 CEST 2003


Michael Stenner wrote:
> 
> Just to be clear, I'm not trying to "use" signals here.  They exist,
> they WILL be sent (when a system shuts down, for example), and I'm
> just trying to tolerate them in a way that doesn't lose data.
> 
> So, the bottom line is:  what do people recommend?

Don't.

That is, don't try to be incredibly tolerant even in the face of
system shutdown and signals that kill your program.

Instead, be tolerant of partially written data structures, half-completed
operations, and so forth.

There is *no* way you can protect against a power outage, and no
way you can protect against something like "kill -9" anyway, so
you are trying to achieve an unattainable level of perfection if
you insist that under other circumstances you *must not* ever
lose data.

At least with this view, you'll find it much easier to deal with
the particular nastiness of signals...  just my view.

-Peter




More information about the Python-list mailing list