This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: threads+CNI+SIGINT
- To: cedric at wireless-networks dot com
- Subject: Re: threads+CNI+SIGINT
- From: Oskar Liljeblad <osk at hem dot passagen dot se>
- Date: Mon, 27 Mar 2000 18:21:09 +0200
- Cc: java-discuss at sourceware dot cygnus dot com
On Monday, March 27, 2000 at 08:05, Cedric Berger wrote:
>
> > How do you deal with objects that override the finalize method,
> > needing special finalization?
>
> Finalization must only be used for releasing resources like memory,
> syncronization objects, ... which means that its main use is for
> native methods.
There is at least one situation in unix where it is (almost) absolutely
necessary: When you need to restore a terminal's state.
If I initialize ncurses natively in some object, I need to either
have the user manually restore the terminal, or do it during
finalization. I prefer the latter because it is easy to write buggy
code that never cleans up. (But it is also easy to write code that
always cleans up - except if the program wa killed by SIGINT/SIGTERM.)
Maybe there is some other solution to this problem that I'm missing...
Oskar Liljeblad (osk@hem.passagen.se)