Merged with mainline at revision 128810.
[official-gcc.git] / libjava / testsuite / libjava.lang / PR27908.java
blobaddb1d7720fc6c9571015b38bc2a5d3fccf9d7e9
1 class PR27908
3 public static void main (String[] argv)
4 throws InterruptedException
6 run1 r1 = new run1();
7 run2 r2 = new run2();
8 run3 r3 = new run3();
10 Thread t1, t2, t3;
12 (t1 = new Thread (r1)).start();
13 (t2 = new Thread (r2)).start();
14 (t3 = new Thread (r3)).start();
16 while (! (r1.isRunning() && r2.isRunning() && r3.isRunning()))
17 Thread.yield();
19 r1.stop();
20 r2.stop();
21 r3.stop();
23 Thread.sleep(5000);
25 if (t1.isAlive() || t2.isAlive() || t3.isAlive())
27 System.out.println ("fail");
28 System.exit(1);
32 private static class run1 implements Runnable
34 volatile int counter;
35 volatile boolean running;
37 public void run ()
39 counter = 0;
40 running = true;
41 while (running)
42 counter++;
45 void stop ()
47 running = false;
50 public boolean isRunning()
52 return running;
56 private static class run2 implements Runnable
58 volatile int counter;
59 boolean running;
61 public void run ()
63 counter = 0;
64 running = true;
65 while (running)
66 counter++;
69 void stop ()
71 running = false;
74 public boolean isRunning()
76 return running;
80 static class run3 implements Runnable
82 volatile int counter;
83 private volatile boolean running;
85 public void run ()
87 counter = 0;
88 running = true;
89 while (running)
90 counter++;
93 void stop ()
95 running = false;
98 public boolean isRunning()
100 return running;