diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/testsuite/libjava.lang/PR27908.java | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/testsuite/libjava.lang/PR27908.java')
-rw-r--r-- | libjava/testsuite/libjava.lang/PR27908.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/PR27908.java b/libjava/testsuite/libjava.lang/PR27908.java new file mode 100644 index 000000000..addb1d772 --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR27908.java @@ -0,0 +1,103 @@ +class PR27908 +{ + public static void main (String[] argv) + throws InterruptedException + { + run1 r1 = new run1(); + run2 r2 = new run2(); + run3 r3 = new run3(); + + Thread t1, t2, t3; + + (t1 = new Thread (r1)).start(); + (t2 = new Thread (r2)).start(); + (t3 = new Thread (r3)).start(); + + while (! (r1.isRunning() && r2.isRunning() && r3.isRunning())) + Thread.yield(); + + r1.stop(); + r2.stop(); + r3.stop(); + + Thread.sleep(5000); + + if (t1.isAlive() || t2.isAlive() || t3.isAlive()) + { + System.out.println ("fail"); + System.exit(1); + } + } + + private static class run1 implements Runnable + { + volatile int counter; + volatile boolean running; + + public void run () + { + counter = 0; + running = true; + while (running) + counter++; + } + + void stop () + { + running = false; + } + + public boolean isRunning() + { + return running; + } + } + + private static class run2 implements Runnable + { + volatile int counter; + boolean running; + + public void run () + { + counter = 0; + running = true; + while (running) + counter++; + } + + void stop () + { + running = false; + } + + public boolean isRunning() + { + return running; + } + } + + static class run3 implements Runnable + { + volatile int counter; + private volatile boolean running; + + public void run () + { + counter = 0; + running = true; + while (running) + counter++; + } + + void stop () + { + running = false; + } + + public boolean isRunning() + { + return running; + } + } +} |