From 362a95fc0d602ec21b2d16f93ec112fd39a41f4b Mon Sep 17 00:00:00 2001 From: bryce Date: Thu, 23 Mar 2000 12:35:44 +0000 Subject: 2000-03-23 Bryce McKinlay * libjava.lang/Thread_Wait.java: New file. * libjava.lang/Thread_Sleep.java: New file. * libjava.lang/Thread_Monitor.java: New file. * libjava.lang/Thread_Wait.out: New file. * libjava.lang/Thread_Sleep.out: New file. * libjava.lang/Thread_Monitor.out: New file. * libjava.lang/Thread_Interrupt.java: New file. * libjava.lang/Thread_Wait_2.java: New file. * libjava.lang/Thread_Wait_2.out: New file. * libjava.lang/Thread_Wait_Interrupt.java: New file. * libjava.lang/Thread_Wait_Interrupt.out: New file. * libjava.lang/Thread_Interrupt.out: New file. * libjava.lang/Thread_Join.java: New file. * libjava.lang/Thread_Join.out: New file. * libjava.lang/Thread_Alive.java: New file. * libjava.lang/Thread_Alive.out: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32706 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/testsuite/libjava.lang/Thread_Alive.java | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 libjava/testsuite/libjava.lang/Thread_Alive.java (limited to 'libjava/testsuite/libjava.lang/Thread_Alive.java') diff --git a/libjava/testsuite/libjava.lang/Thread_Alive.java b/libjava/testsuite/libjava.lang/Thread_Alive.java new file mode 100644 index 00000000000..d97ea25c5d3 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Thread_Alive.java @@ -0,0 +1,47 @@ +// Test the status of the isAlive() flag before, during, and after thread +// execution. Check that thread's threadgroup is null after thread exits. +// Origin: Bryce McKinlay + +public class Thread_Alive implements Runnable +{ + public static void main(String args[]) throws InterruptedException + { + Thread_Alive ta = new Thread_Alive(); + Thread t = new Thread(ta); + System.out.println(t.isAlive()); + t.start(); + System.out.println(t.isAlive()); + + Thread.sleep(100); + + synchronized (ta) + { + ta.notifyAll(); + } + + t.join(); + System.out.println(t.isAlive()); + + try + { + t.start(); + System.out.println("Error: dead thread can be restarted."); + } + catch (IllegalThreadStateException x) + { + System.out.println ("ok"); + } + + System.out.println(t.getThreadGroup()); + } + + public synchronized void run() + { + try + { + wait(); + } + catch (InterruptedException x) {} + } + +} -- cgit v1.2.3