This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: threads+CNI+SIGINT
- To: Oskar Liljeblad <osk at hem dot passagen dot se>
- Subject: Re: threads+CNI+SIGINT
- From: Cedric Berger <cedric at wireless-networks dot com>
- Date: Mon, 27 Mar 2000 08:47:45 -0800
- CC: java-discuss at sourceware dot cygnus dot com
- Organization: Wireless Networks Inc
- References: <20000327182109.A10624@strix.eductussyd.se>
I looks like that you'll have to wait for JDK1.3 that implements the
mechanism you want in Runtime.addShutdownHook.
see at:
http://java.sun.com/products/jdk/1.3/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
Cedric
Oskar Liljeblad wrote:
> 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)
begin:vcard
n:Berger;Cedric
tel;fax:++1 (650) 574-4476
tel;work:++1 (650) 574-4472
x-mozilla-html:TRUE
org:Wireless Networks Inc
version:2.1
email;internet:cedric@wireless-networks.com
title:Embedded Software Engineer
adr;quoted-printable:;;2322 El Camino Real=0D=0A;San Mateo;CA;94403;USA
fn:Cedric Berger
end:vcard