Threads now close down even if main thread
authorschani <none@none>
Mon, 16 Nov 1998 16:49:18 +0000 (16:49 +0000)
committerschani <none@none>
Mon, 16 Nov 1998 16:49:18 +0000 (16:49 +0000)
exits prematurely.

Makefile
main.c
src/cacao/cacao.c
src/threads/green/threads.c
threads/thread.c

index 72f6839dc6ae0616c5e7222565038b61d04e6e62..30d4292b6671083c16c278c87f1c33d4d3a46a5e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@
 # Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
 #          Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
 #
-# Last Change: $Id: Makefile 54 1998-11-10 12:12:02Z phil $
+# Last Change: $Id: Makefile 70 1998-11-16 16:49:18Z schani $
 #
 #
 # ATTENTION: This version of the makefile only works with gmake.
@@ -31,8 +31,8 @@ VERSION_STRING=$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POSTFIX)
 ##################### generation of the excutable ##############################
 
 # Enabling/disabling thread support
-USE_THREADS = YES
-USE_THREADS = NO
+USE_THREADS = YES
+#USE_THREADS = NO
 
 ifeq ($(USE_THREADS),YES)
 THREAD_OBJ = threads/threads.a
@@ -48,7 +48,7 @@ endif
 #LFLAGS = -lm
 
 CC = cc
-CFLAGS = -g3 -ieee $(THREAD_CFLAGS)
+CFLAGS = -g -ieee $(THREAD_CFLAGS)
 #CFLAGS = -O3 -ieee $(THREAD_CFLAGS)
 LFLAGS = -lm
 
diff --git a/main.c b/main.c
index 33cd8214e83ae9751634afd86387335611bdb8cc..c4e5e9f944b8d022dbfe7495d945574fcf636dba 100644 (file)
--- a/main.c
+++ b/main.c
@@ -33,7 +33,7 @@
 #include "builtin.h"
 #include "native.h"
 
-#include "threads/thread.h"            /* schani */
+#include "threads/thread.h"
 
 bool compileall = false;
 int  newcompiler = true;               
@@ -42,6 +42,11 @@ bool verbose =  false;
 bool new_gc = false;
 #endif
 
+static bool showmethods = false;
+static bool showconstantpool = false;
+static bool showunicode = false;
+static classinfo *topclass;
+
 #ifndef USE_THREADS
 void **stackbottom = 0;
 #endif
@@ -445,8 +450,15 @@ void class_compile_methods ()
 
 void exit_handler(void)
 {
+       /********************* Debug-Tabellen ausgeben ************************/
+                               
+       if (showmethods) class_showmethods (topclass);
+       if (showconstantpool)  class_showconstantpool (topclass);
+       if (showunicode)       unicode_show ();
+
 #ifdef USE_THREADS
-       clear_thread_flags();
+       clear_thread_flags();           /* restores standard file descriptor
+                                                                  flags */
 #endif
 
        /************************ Freigeben aller Resourcen *******************/
@@ -483,7 +495,6 @@ int main(int argc, char **argv)
 {
        s4 i,j;
        char *cp;
-       classinfo *topclass;
        java_objectheader *exceptionptr;
        void *dummy;
        
@@ -493,9 +504,6 @@ int main(int argc, char **argv)
        u4 heapsize = 16000000;
        u4 heapstartsize = 200000;
        char classpath[500] = ".:/usr/local/lib/java/classes";
-       bool showmethods = false;
-       bool showconstantpool = false;
-       bool showunicode = false;
        bool startit = true;
        char *specificmethodname = NULL;
        char *specificsignature = NULL;
@@ -750,8 +758,8 @@ int main(int argc, char **argv)
                        printf ("\n");
                }
 
-               /*              killThread(currentThread); */
-
+               killThread(currentThread);
+               fprintf(stderr, "still here\n");
        }
 
        /************* Auf Wunsch alle Methode "ubersetzen ********************/
@@ -783,12 +791,6 @@ int main(int argc, char **argv)
 #endif
        }
 
-       /********************* Debug-Tabellen ausgeben ************************/
-                               
-       if (showmethods) class_showmethods (topclass);
-       if (showconstantpool)  class_showconstantpool (topclass);
-       if (showunicode)       unicode_show ();
-
        exit(0);
 }
 
index 33cd8214e83ae9751634afd86387335611bdb8cc..c4e5e9f944b8d022dbfe7495d945574fcf636dba 100644 (file)
@@ -33,7 +33,7 @@
 #include "builtin.h"
 #include "native.h"
 
-#include "threads/thread.h"            /* schani */
+#include "threads/thread.h"
 
 bool compileall = false;
 int  newcompiler = true;               
@@ -42,6 +42,11 @@ bool verbose =  false;
 bool new_gc = false;
 #endif
 
+static bool showmethods = false;
+static bool showconstantpool = false;
+static bool showunicode = false;
+static classinfo *topclass;
+
 #ifndef USE_THREADS
 void **stackbottom = 0;
 #endif
@@ -445,8 +450,15 @@ void class_compile_methods ()
 
 void exit_handler(void)
 {
+       /********************* Debug-Tabellen ausgeben ************************/
+                               
+       if (showmethods) class_showmethods (topclass);
+       if (showconstantpool)  class_showconstantpool (topclass);
+       if (showunicode)       unicode_show ();
+
 #ifdef USE_THREADS
-       clear_thread_flags();
+       clear_thread_flags();           /* restores standard file descriptor
+                                                                  flags */
 #endif
 
        /************************ Freigeben aller Resourcen *******************/
@@ -483,7 +495,6 @@ int main(int argc, char **argv)
 {
        s4 i,j;
        char *cp;
-       classinfo *topclass;
        java_objectheader *exceptionptr;
        void *dummy;
        
@@ -493,9 +504,6 @@ int main(int argc, char **argv)
        u4 heapsize = 16000000;
        u4 heapstartsize = 200000;
        char classpath[500] = ".:/usr/local/lib/java/classes";
-       bool showmethods = false;
-       bool showconstantpool = false;
-       bool showunicode = false;
        bool startit = true;
        char *specificmethodname = NULL;
        char *specificsignature = NULL;
@@ -750,8 +758,8 @@ int main(int argc, char **argv)
                        printf ("\n");
                }
 
-               /*              killThread(currentThread); */
-
+               killThread(currentThread);
+               fprintf(stderr, "still here\n");
        }
 
        /************* Auf Wunsch alle Methode "ubersetzen ********************/
@@ -783,12 +791,6 @@ int main(int argc, char **argv)
 #endif
        }
 
-       /********************* Debug-Tabellen ausgeben ************************/
-                               
-       if (showmethods) class_showmethods (topclass);
-       if (showconstantpool)  class_showconstantpool (topclass);
-       if (showunicode)       unicode_show ();
-
        exit(0);
 }
 
index 55eeea3d69cbbcb800b4c97307d30812bef1f94e..97e18c11f743a4b1213351e506ba0f8a8a48f5ff 100644 (file)
@@ -505,7 +505,7 @@ killThread(thread* tid)
 
                /* If we only have daemons left, then everyone is dead. */
                if (talive == tdaemon) {
-                       /* Am I suppose to close things down nicely ?? */
+                       /* atexit functions get called to clean things up */
                        exit(0);
                }
 
index 55eeea3d69cbbcb800b4c97307d30812bef1f94e..97e18c11f743a4b1213351e506ba0f8a8a48f5ff 100644 (file)
@@ -505,7 +505,7 @@ killThread(thread* tid)
 
                /* If we only have daemons left, then everyone is dead. */
                if (talive == tdaemon) {
-                       /* Am I suppose to close things down nicely ?? */
+                       /* atexit functions get called to clean things up */
                        exit(0);
                }