[kaffe] shutdownHook changes broke the build
Guilhem Lavaux
guilhem.lavaux@free.fr
Tue Jul 8 23:46:01 2003
--Boundary-00=_gu7C/COKJ9//GPv
Content-Type: Text/Plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Description: clearsigned data
Content-Disposition: inline
Hi,
I have reversed one or two things concerning kaffe.lang.Application to brin=
g=20
it back in CVS and added its functionality in java.lang.Runtime.exit. This=
=20
must be considered as a temporary patch to make kaffe works as I do not thi=
nk=20
that kaffe.lang.Application creates an inner application really rightly (fo=
r=20
example I can only have one Application unless I want to mess everything in=
=20
the VM and Application cannot be multithreaded). Maybe this should be clean=
ed=20
up with a sort of kaffe.lang.ProcessGroup which contains all threads of a=20
sub-process and Application should be an object attribute of a Thread...
Regards,
Guilhem.
P.S.: Someone will need to re-add kaffe/lang/Application.java and=20
clib/native/Application.c
P.P.S: Apparently this patch compiles on my computer but ShutdownHookTest h=
as=20
a problem while removing the "dummy" thread as it is executed during the=20
shutdown phase. I will have a look this evening...
--Boundary-00=_gu7C/COKJ9//GPv
Content-Type: text/x-diff;
charset="iso-8859-1";
name="application.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="application.patch"
Index: libraries/clib/native/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Makefile.am,v
retrieving revision 1.21
diff -u -3 -p -r1.21 Makefile.am
--- libraries/clib/native/Makefile.am 8 Jul 2003 23:48:24 -0000 1.21
+++ libraries/clib/native/Makefile.am 9 Jul 2003 06:27:45 -0000
@@ -16,6 +16,7 @@ IO_SRCS = \
ObjectStreamClassImpl.c
LANG_SRCS = \
+ Application.c \
Class.c \
ClassLoader.c \
Compiler.c \
Index: libraries/javalib/Klasses.jar.bootstrap
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/Klasses.jar.bootstrap,v
retrieving revision 1.20
diff -u -3 -p -r1.20 Klasses.jar.bootstrap
Binary files /tmp/cvswwpqJy and Klasses.jar.bootstrap differ
Index: libraries/javalib/essential.files
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/essential.files,v
retrieving revision 1.11
diff -u -3 -p -r1.11 essential.files
--- libraries/javalib/essential.files 8 Jul 2003 23:48:25 -0000 1.11
+++ libraries/javalib/essential.files 9 Jul 2003 06:27:52 -0000
@@ -283,6 +283,7 @@ kaffe/io/StdErrorStream.java
kaffe/io/StdInputStream.java
kaffe/io/StdOutputStream.java
kaffe/lang/AppClassLoader.java
+kaffe/lang/Application.java
kaffe/lang/ApplicationException.java
kaffe/lang/ApplicationResource.java
kaffe/lang/ClassPathReader.java
Index: libraries/javalib/java/lang/Runtime.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/Runtime.java,v
retrieving revision 1.24
diff -u -3 -p -r1.24 Runtime.java
--- libraries/javalib/java/lang/Runtime.java 8 Jul 2003 23:48:25 -0000 1.24
+++ libraries/javalib/java/lang/Runtime.java 9 Jul 2003 06:27:52 -0000
@@ -101,10 +101,18 @@ public void exit(int status) throws Secu
if (sm != null)
sm.checkExit(status);
- /* First we cleanup the Virtual Machine */
- exitJavaCleanup();
- /* Now we run the VM exit function */
- exit0(status);
+ // Handle application extensions - if this thread is part of an
+ // application then we exit that rather than the whole thing.
+ if (!kaffe.lang.Application.exit(status)) {
+ /* First we cleanup the Virtual Machine */
+ exitJavaCleanup();
+ /* Now we run the VM exit function */
+ exit0(status);
+ }
+ // kaffe.lang.Application.exit does not destroy the thread
+ // that invoked exit(). We stop that thread now.
+ Thread.currentThread().destroy();
+
}
public void halt(int status) throws SecurityException {
Index: libraries/javalib/java/lang/Thread.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/Thread.java,v
retrieving revision 1.41
diff -u -3 -p -r1.41 Thread.java
--- libraries/javalib/java/lang/Thread.java 8 Jul 2003 23:48:25 -0000 1.41
+++ libraries/javalib/java/lang/Thread.java 9 Jul 2003 06:27:52 -0000
@@ -13,6 +13,7 @@ package java.lang;
import java.util.HashMap;
import java.util.Iterator;
import java.security.AccessController;
+import kaffe.lang.Application;
import kaffe.lang.ApplicationResource;
public class Thread
@@ -90,7 +91,9 @@ public Thread(ThreadGroup group, Runnabl
this.group.checkAccess();
this.group.add(this);
+ // make sure this.name is non-zero before calling addResource
this.name = name.toCharArray();
+ Application.addResource(this);
this.target = target;
this.interrupting = false;
@@ -160,6 +163,7 @@ public void destroy() {
if (group != null) {
group.remove(this);
}
+ Application.removeResource(this);
destroy0();
}
--Boundary-00=_gu7C/COKJ9//GPv--