[kaffe] CVS kaffe (noa): test/regression/ThreadState.java: Call System.exit(-1) if there

Kaffe CVS cvs-commits at kaffe.org
Fri Nov 5 16:02:13 PST 2004


PatchSet 5400 
Date: 2004/11/05 23:58:00
Author: noa
Branch: HEAD
Tag: (none) 
Log:
2004-11-06  Noa Resare  <noa at resare.com>

        * test/regression/ThreadState.java: Call System.exit(-1) if there
        was an exception in a tread.

Members: 
	ChangeLog:1.2949->1.2950 
	test/regression/ThreadState.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2949 kaffe/ChangeLog:1.2950
--- kaffe/ChangeLog:1.2949	Fri Nov  5 13:52:42 2004
+++ kaffe/ChangeLog	Fri Nov  5 23:58:00 2004
@@ -1,3 +1,8 @@
+2004-11-06  Noa Resare  <noa at resare.com>
+
+	* test/regression/ThreadState.java: Call System.exit(-1) if there
+	was an exception in a tread.
+
 2004-11-04  Noa Resare  <noa at resare.com>
 
 	* libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:
Index: kaffe/test/regression/ThreadState.java
diff -u kaffe/test/regression/ThreadState.java:1.5 kaffe/test/regression/ThreadState.java:1.6
--- kaffe/test/regression/ThreadState.java:1.5	Mon Jun 30 15:46:50 2003
+++ kaffe/test/regression/ThreadState.java	Fri Nov  5 23:58:04 2004
@@ -50,73 +50,83 @@
   }
 
   public void run() {
-    verbose(getName() + " running");
-
-    // Create child thread
-    Thread t = new Thread() {
-      public synchronized void run() {
-	childRunning = true;
-	verbose(ThreadState.this.getName() + " child running [child]");
-	try {
-	  this.wait(0);
-	} catch (InterruptedException e) {
-	  check(false, "thread " + e);
-	}
-	verbose(ThreadState.this.getName() + " child thread exiting");
-      }
-    };
-
-    // Check state
-    check(!t.isAlive(), "alive before start()");
-    verbose(getName() + " starting child thread");
-    t.start();
-    check(t.isAlive(), "dead after start()");
-
-    // Check setDaemon after start()
     try {
-      t.setDaemon(false);
-      check(false, "setDaemon() after start");
-    } catch (IllegalThreadStateException e) {
-    }
+      verbose(getName() + " running");
 
-    // Check double start()
-    try {
+      // Create child thread
+      Thread t = new Thread() {
+        public synchronized void run() {
+          try {
+	    childRunning = true;
+	    verbose(ThreadState.this.getName() + " child running [child]");
+	    try {
+	      this.wait(0);
+	    } catch (InterruptedException e) {
+	      check(false, "thread " + e);
+	    }
+	  verbose(ThreadState.this.getName() + " child thread exiting");
+          } catch (Throwable t) {
+            t.printStackTrace();
+	    System.exit(-1);
+	  }
+        }
+      };
+
+      // Check state
+      check(!t.isAlive(), "alive before start()");
+      verbose(getName() + " starting child thread");
       t.start();
-      check(false, "start() while alive");
-    } catch (IllegalThreadStateException e) {
-    }
-
-    // Wait for thread to be running
-    while (!childRunning) {
-      Thread.yield();
-    }
-    verbose(getName() + " child thread running [parent]");
-
-    // Notify child he can exit
-    synchronized (t) {
-      t.notify();
-    }
+      check(t.isAlive(), "dead after start()");
+  
+      // Check setDaemon after start()
+      try {
+        t.setDaemon(false);
+        check(false, "setDaemon() after start");
+      } catch (IllegalThreadStateException e) {
+      }
 
-    verbose(getName() + " joining my child thread");
-    try {
-      t.join();
-    } catch (InterruptedException e) {
-      check(false, "join: " + e);
-    }
-    check(!t.isAlive(), "alive after join()");
+      // Check double start()
+      try {
+        t.start();
+        check(false, "start() while alive");
+      } catch (IllegalThreadStateException e) {
+      }
+  
+      // Wait for thread to be running
+      while (!childRunning) {
+        Thread.yield();
+      }
+      verbose(getName() + " child thread running [parent]");
 
-    // Check double start()
-    try {
-      t.start();
-      check(false, "start() after dead");
-    } catch (IllegalThreadStateException e) {
-    }
+      // Notify child he can exit
+      synchronized (t) {
+        t.notify();
+      }
+  
+      verbose(getName() + " joining my child thread");
+      try {
+        t.join();
+      } catch (InterruptedException e) {
+        check(false, "join: " + e);
+      }
+      check(!t.isAlive(), "alive after join()");
+  
+      // Check double start()
+      try {
+        t.start();
+        check(false, "start() after dead");
+      } catch (IllegalThreadStateException e) {
+      }
 
-    // OK
-    synchronized (ThreadState.class) {
-      System.out.println("Success.");
+      // OK
+      synchronized (ThreadState.class) {
+        System.out.println("Success.");
+      }
+      verbose(getName() + " exiting");
+    } catch (Throwable t) {
+      t.printStackTrace();
+      System.exit(-1);
     }
-    verbose(getName() + " exiting");
   }
 
   public static void check(boolean that, String msg) {




More information about the kaffe mailing list