[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Errors while shutting down



On Tue, Oct 12, 1999 at 10:57:21AM +0300, Martin-Eric Racine wrote:
> On Tue, 12 Oct 1999, Mario Becroft wrote:
> 
> > I noticed a lot of messages scroll past just before the
> > machine rebooted which were too quick to read but I managed
> > to catch some words which read something similar to "OPEN
> > FILEPTR detected."
> > 
> > I suppose that this is not the expected behaviour. 
> 
> This is caused by applications that forget to close all currently
> opened files before exiting, when they receive the KILL signal.
> ...as far as I can tell, anyhow.

Definitely not.

You only have to close files (not FILE* streams, they are buffered) when
you're afraid to run out of descriptors (handles).  It is perfectly
alright to exit without closing open descriptors (and btw, freeing memory
on exit is also a waste of time).

In signal handlers it is mostly a bad idea to close files (because that
may block and could trigger other signals/race conditions...).  Instead
of closing files you should rather delete them if you haven't finished
writing to them. 

On the other hand, if you install a handler for the KILL signal, all of
this is alright, it will do no harm, I can guarantee that. ;-)

Ciao

Guido
-- 
http://stud.uni-sb.de/~gufl0000/
mailto:gufl0000@stud.uni-sb.de