Index: ChangeLog from Alexandre Oliva * libraries/javalib/java/lang/Thread.java (Finalizer): rename to ThreadFinalizer, and make it top-level, to avoid problems with `$' in identifiers and filenames * include/Makefile.in (derived-files): ditto * include/java_lang_ThreadFinalizer.h: new file * include/java_lang_Thread.h: regen * libraries/clib/native/Thread.c: include ThreadFinalizer.h * include/java_lang_Thread$Finalizer.h: removed * libraries/javalib/Klasses.jar: regen Index: include/Makefile.in =================================================================== RCS file: /home/cvspublic/kaffe/include/Makefile.in,v retrieving revision 1.13 diff -u -r1.13 Makefile.in --- include/Makefile.in 1998/12/13 03:40:37 1.13 +++ include/Makefile.in 1998/12/13 19:50:52 @@ -54,6 +54,7 @@ derived-files: $(KAFFEH) -d @srcdir@ -classpath $(INSTROOT)$(classdir)/Klasses.jar java/lang/Thread + $(KAFFEH) -d @srcdir@ -classpath $(INSTROOT)$(classdir)/Klasses.jar java/lang/ThreadFinalizer $(KAFFEH) -d @srcdir@ -classpath $(INSTROOT)$(classdir)/Klasses.jar java/lang/ThreadGroup $(KAFFEH) -d @srcdir@ -classpath $(INSTROOT)$(classdir)/Klasses.jar java/lang/Throwable Index: include/java_lang_ThreadFinalizer.h =================================================================== RCS file: java_lang_ThreadFinalizer.h diff -N java_lang_ThreadFinalizer.h --- include/java_lang_ThreadFinalizer.h Mon Dec 31 20:00:00 1979 +++ include/java_lang_ThreadFinalizer.h Sun Dec 13 11:50:52 1998 @@ -0,0 +1,24 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include + +#ifndef _Included_java_lang_ThreadFinalizer +#define _Included_java_lang_ThreadFinalizer + +#ifdef __cplusplus +extern "C" { +#endif + +/* Header for class java_lang_ThreadFinalizer */ + +typedef struct Classjava_lang_ThreadFinalizer { + struct Hjava_lang_Thread* thisThread; +} Classjava_lang_ThreadFinalizer; +HandleTo(java_lang_ThreadFinalizer); + +extern void java_lang_ThreadFinalizer_finalize(struct Hjava_lang_ThreadFinalizer*); + +#ifdef __cplusplus +} +#endif + +#endif Index: libraries/clib/native/Makefile.in =================================================================== RCS file: /home/cvspublic/kaffe/libraries/clib/native/Makefile.in,v retrieving revision 1.19 diff -u -r1.19 Makefile.in --- libraries/clib/native/Makefile.in 1998/12/12 12:29:35 1.19 +++ libraries/clib/native/Makefile.in 1998/12/13 19:50:53 @@ -121,7 +121,7 @@ depend: external_wrappers.h $(DEPENDS) rm -f .depend - sed 's/\$$/$$$$/' $(DEPENDS) > .depend + cat $(DEPENDS) > .depend lib.exp: $(DLLTOOL) --def $(srcdir)/$(LIBNAME).def --output-exp lib.exp --output-lib $(LIBNAME).a --dllname $(LLIB) Index: libraries/clib/native/Thread.c =================================================================== RCS file: /home/cvspublic/kaffe/libraries/clib/native/Thread.c,v retrieving revision 1.9 diff -u -r1.9 Thread.c --- libraries/clib/native/Thread.c 1998/12/13 00:32:11 1.9 +++ libraries/clib/native/Thread.c 1998/12/13 19:50:53 @@ -119,8 +119,10 @@ interruptThread(this); } +#include "../../../include/java_lang_ThreadFinalizer.h" + void -java_lang_Thread_finalize0(struct Hjava_lang_Thread* this) +java_lang_ThreadFinalizer_finalize(struct Hjava_lang_ThreadFinalizer* this) { - finalizeThread(this); + finalizeThread(unhand(this)->thisThread); } Index: libraries/javalib/Klasses.jar =================================================================== RCS file: /home/cvspublic/kaffe/libraries/javalib/Klasses.jar,v retrieving revision 1.42 diff -u -r1.42 Klasses.jar Binary files /tmp/cvs05048eaa and Klasses.jar differ Index: libraries/javalib/java/lang/Thread.java =================================================================== RCS file: /home/cvspublic/kaffe/libraries/javalib/java/lang/Thread.java,v retrieving revision 1.15 diff -u -r1.15 Thread.java --- Thread.java 1998/12/13 00:32:30 1.15 +++ Thread.java 1998/12/13 19:51:16 @@ -137,14 +137,8 @@ return (Thread.currentThread().getThreadGroup().enumerate(tarray)); } -final native private void finalize0(); +private Object finalizeHelper = new ThreadFinalizer(this); -private Object finalizeHelper = new Object() { - protected void finalize() throws Throwable { - finalize0(); - } -}; - /* * Called by system when thread terminates (for whatever reason) */ @@ -323,3 +317,15 @@ native public static void yield(); } + + +/** Helper class to release Thread resources. */ +class ThreadFinalizer { +private final Thread thisThread; + +ThreadFinalizer(final Thread thisThread) { + this.thisThread = thisThread; +} + +protected native void finalize() throws Throwable; +};