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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jvmti/] [getallthreads.java] - Blame information for rev 775

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

Line No. Rev Author Line
1 765 jeremybenn
// Test JVMTI GetAllThreads
2
 
3
import java.util.ArrayList;
4
 
5
public class getallthreads extends Thread
6
{
7
         public static int thread_num;
8
         public static ArrayList threads;
9
 
10
         public int ex_frames;
11
  public boolean done = false;
12
 
13
  public static native void do_getallthreads_tests ();
14
 
15
  public void run ()
16
         {
17
    ex_frames = thread_num;
18
                 thread_num++;
19
 
20
                 if (ex_frames > 0)
21
                   {
22
        if ((ex_frames % 2) == 0)
23
                                         placeholder ();
24
                                 else
25
                                         natPlaceholder ();
26
                   }
27
                 else
28
      runner ();
29
         }
30
 
31
         public native void natPlaceholder ();
32
         public native void natRunner ();
33
 
34
         public void placeholder ()
35
         {
36
                 ex_frames--;
37
 
38
                 if (ex_frames > 0)
39
                   {
40
                                 if ((thread_num % 2) == 0)
41
                                         placeholder ();
42
                                 else
43
                                         natPlaceholder ();
44
                         }
45
                 else
46
                         runner ();
47
   }
48
 
49
         public void runner ()
50
         {
51
                 done = true;
52
                 while (done)
53
                        yield ();
54
         }
55
 
56
  public static void main (String[] args)
57
  {
58
    System.out.println ("JVMTI GetAllThreads tests");
59
    threads = new ArrayList (20);
60
 
61
                getallthreads t;
62
 
63
                for (int i = 0; i < 20; i++)
64
                  {
65
                                t = new getallthreads ();
66
                                threads.add (t);
67
                                t.start ();
68
                                while (!t.done)
69
                                        yield ();
70
                        }
71
 
72
                do_getallthreads_tests ();
73
 
74
                for (int i = 0; i < 20; i++)
75
                  {
76
                                t = (getallthreads) threads.get(i);
77
                                t.done = false;
78
                        }
79
  }
80
}

powered by: WebSVN 2.1.0

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