diff options
author | Tom Tromey <tromey@redhat.com> | 2006-01-06 01:03:45 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-01-06 01:03:45 +0000 |
commit | 1058a848dcd220965dd4d126eb9f4159782dd586 (patch) | |
tree | b1406d0aef45f9b54fc3cb3b56375bc3ce39b15c /libjava/gnu | |
parent | 0c158c887f3669dd47297b68b1aa490f5da5b7ad (diff) | |
download | gcc-1058a848dcd220965dd4d126eb9f4159782dd586.zip gcc-1058a848dcd220965dd4d126eb9f4159782dd586.tar.gz gcc-1058a848dcd220965dd4d126eb9f4159782dd586.tar.bz2 |
natThread.cc (finish_): Don't clear 'group'.
* java/lang/natThread.cc (finish_): Don't clear 'group'.
* sources.am, Makefile.in: Rebuilt.
* java/lang/Runtime.java (exit): Merged with Classpath.
(runShutdownHooks): New method from Classpath.
* java/io/File.java (deleteOnExit): Use DeleteFileHelper, not
FileDeleter.
* gnu/gcj/runtime/FileDeleter.java: Removed.
* java/lang/natRuntime.cc (runFinalizationForExit): New method.
(exitInternal): Don't run finalizers or delete files.
From-SVN: r109400
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/gcj/runtime/FileDeleter.java | 35 | ||||
-rw-r--r-- | libjava/gnu/java/lang/natMainThread.cc | 16 |
2 files changed, 15 insertions, 36 deletions
diff --git a/libjava/gnu/gcj/runtime/FileDeleter.java b/libjava/gnu/gcj/runtime/FileDeleter.java deleted file mode 100644 index d5f99d0..0000000 --- a/libjava/gnu/gcj/runtime/FileDeleter.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package gnu.gcj.runtime; - -import java.io.*; -import java.util.*; - -public final class FileDeleter -{ - public synchronized static void add (File f) - { - if (deleteOnExitStack == null) - deleteOnExitStack = new Stack (); - - deleteOnExitStack.push (f); - } - - // Helper method called by java.lang.Runtime.exit() to perform - // pending deletions. - public synchronized static void deleteOnExitNow () - { - if (deleteOnExitStack != null) - while (!deleteOnExitStack.empty ()) - ((File)(deleteOnExitStack.pop ())).delete (); - } - - // A stack of files to delete upon normal termination. - private static Stack deleteOnExitStack; -} diff --git a/libjava/gnu/java/lang/natMainThread.cc b/libjava/gnu/java/lang/natMainThread.cc index 7e8e422..95626eb 100644 --- a/libjava/gnu/java/lang/natMainThread.cc +++ b/libjava/gnu/java/lang/natMainThread.cc @@ -1,6 +1,6 @@ // natMainThread.cc - Implementation of MainThread native methods. -/* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2006 Free Software Foundation This file is part of libgcj. @@ -15,8 +15,11 @@ details. */ #include <gcj/cni.h> #include <jvm.h> +#include <java-threads.h> #include <gnu/java/lang/MainThread.h> +#include <java/lang/Runtime.h> +#include <java/lang/ThreadGroup.h> typedef void main_func (jobject); @@ -45,4 +48,15 @@ gnu::java::lang::MainThread::call_main (void) main_func *real_main = (main_func *) meth->ncode; (*real_main) (args); + + // Note that we do thread cleanup here. We have to do this here and + // not in _Jv_RunMain; if we do if after the main thread has exited, + // our ThreadGroup will be null, and if Runtime.exit tries to create + // a new Thread (which it does when running shutdown hooks), it will + // eventually NPE due to this. + _Jv_ThreadWait (); + + int status = (int) ::java::lang::ThreadGroup::had_uncaught_exception; + ::java::lang::Runtime *runtime = ::java::lang::Runtime::getRuntime (); + runtime->exit (status); } |