On Sun, 2009-03-29 at 22:44 +0100, Matthew Garrett wrote:
Firefox does this by saving its session every time you hit a new
page.
It's actually remarkably difficult to handle the "My X server has gone
away" case - traditional xlib behaviour is to just abort() your process.
You can do some funky stuff involving signal handlers and longjmp, but
by and large it's not practical to save app state when the server is
killed.
And yet somehow many existing apps manage to do it...
A resilient app has to be able to handle having the plug pulled with no
warning anyway.
Especially if your application isn't an X one and just happens
to run in a console.
On the console we've had this thing called SIGHUP for the last few
decades...
http://en.wikipedia.org/wiki/SIGHUP