OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Thread_Alive.java] - Blame information for rev 772

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Test the status of the isAlive() flag before, during, and after thread 
2
// execution. Check that thread's threadgroup is null after thread exits.
3
 
4
public class Thread_Alive implements Runnable
5
{
6
  public static void main(String args[]) throws InterruptedException
7
  {
8
    Thread_Alive ta = new Thread_Alive();
9
    Thread t = new Thread(ta);
10
    System.out.println(t.isAlive());
11
    t.start();
12
    System.out.println(t.isAlive());
13
 
14
    Thread.sleep(50);
15
 
16
    synchronized (ta)
17
    {
18
      ta.notifyAll();
19
    }
20
 
21
    t.join();
22
    System.out.println(t.isAlive());
23
 
24
    try
25
    {
26
      t.start();
27
      System.out.println("Error: dead thread can be restarted.");
28
    }
29
    catch (IllegalThreadStateException x)
30
    {
31
      System.out.println ("ok");
32
    }
33
 
34
    System.out.println(t.getThreadGroup());
35
  }
36
 
37
  public synchronized void run()
38
  {
39
    try
40
    {
41
      wait();
42
    }
43
    catch (InterruptedException x) {}
44
  }
45
 
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.