This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CNI invocation API proposal


Joerg Brunsmann wrote:

> Stupid question: if the gcj environment is created
> without a main function thread do we still need
> a "termination loop" which waits for termination of
> all other threads? Or will the gcj environment
> (javavm) will automatically be closed if all
> thread terminate?

There needs to be some way to execute VM shutdown actions (ala the Java 1.3
ShutdownHook API). These should always be run regardless of how the runtime
was started and how it is shutdown (Ctrl-C shouldn't prevent shutdown hooks
being run, etc).

Its probably possible to do this without a "sentinel" thread, but it might
make things more complex and less portable, so I'm inclined to stick with the
existing approach unless there's a good reason to change it. The
JvAttach() function or whatever would just need to check if the sentinel has
already been started, and start one if it hasn't. Currently we don't
implement the ShutdownHook stuff but there are certainly places that could
use it: eg cleanup of files created by File.createTempFile().

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]