Thread_Wait.java: New file.
2000-03-23 Bryce McKinlay <bryce@albatross.co.nz> * 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. From-SVN: r32706
This commit is contained in:
parent
8034da37ce
commit
e8904f655d
17 changed files with 683 additions and 0 deletions
47
libjava/testsuite/libjava.lang/Thread_Alive.java
Normal file
47
libjava/testsuite/libjava.lang/Thread_Alive.java
Normal file
|
@ -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 <bryce@albatross.co.nz>
|
||||
|
||||
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) {}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue