Re: Closing database in exit handler

Matthias Andree <[email protected]> Sun, 11 Sep 2005 18:14:54 +0200
Newsgroups gmane.mail.bogofilter.devel
Message-ID <[email protected]>
Stefan Bellon <[email protected]> writes:

> On RISC OS, file handles are not automatically closed by the operating
> system when a process dies (yes, this is annoying but cannot be
> changed).

So write a robust supervisor process that cleans up after the other
process.

> So, if a process crashes and had file handles open at that time, they
> remain open and the user has to close them manually.

Well, bogofilter assumes POSIX semantics. If we don't get them, tough luck.

> When Bogofilter crashes (rarely the case, but happens from time to
> time), it leaves wordlist.db open. I have no idea where in the code the
> exact places are, but those in the know, couldn't they just add
> something like
>
>    open_database();
>    atexit(close_database);
>
> i.e. register an exit handler when the database got opened?

This doesn't help if bogofilter crashes or is terminated by signal.

-- 
Matthias Andree
_______________________________________________
Bogofilter-dev mailing list
[email protected]
http://www.bogofilter.org/mailman/listinfo/bogofilter-dev