OSDN Git Service

2007-09-04 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Sep 2007 17:54:56 +0000 (17:54 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Sep 2007 17:54:56 +0000 (17:54 +0000)
PR java/27908
* testsuite/libjava.lang/PR27908.java
({run1,run2,run3}.isRunning): New Method.
(main): Fix race condition.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128094 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/testsuite/libjava.lang/Foo.class [new file with mode: 0644]
libjava/testsuite/libjava.lang/PR27908.jar
libjava/testsuite/libjava.lang/PR27908.java
libjava/testsuite/libjava.lang/WalkerTest.jar [new file with mode: 0644]
libjava/testsuite/libjava.lang/WalkerTest.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/WalkerTest.out [new file with mode: 0644]

diff --git a/libjava/testsuite/libjava.lang/Foo.class b/libjava/testsuite/libjava.lang/Foo.class
new file mode 100644 (file)
index 0000000..b51c95f
Binary files /dev/null and b/libjava/testsuite/libjava.lang/Foo.class differ
index e280407..1ec1127 100644 (file)
Binary files a/libjava/testsuite/libjava.lang/PR27908.jar and b/libjava/testsuite/libjava.lang/PR27908.jar differ
index 09f9654..addb1d7 100644 (file)
@@ -13,7 +13,8 @@ class PR27908
     (t2 = new Thread (r2)).start();
     (t3 = new Thread (r3)).start();
 
-    Thread.yield();
+    while (! (r1.isRunning() && r2.isRunning() && r3.isRunning()))
+      Thread.yield();
 
     r1.stop();
     r2.stop();
@@ -45,6 +46,11 @@ class PR27908
     {
       running = false;
     }
+
+    public boolean isRunning()
+    {
+      return running;
+    }
   }
 
   private static class run2 implements Runnable
@@ -64,6 +70,11 @@ class PR27908
     {
       running = false;
     }
+
+    public boolean isRunning()
+    {
+      return running;
+    }
   }
 
   static class run3 implements Runnable
@@ -83,5 +94,10 @@ class PR27908
     {
       running = false;
     }
+
+    public boolean isRunning()
+    {
+      return running;
+    }
   }
 }
diff --git a/libjava/testsuite/libjava.lang/WalkerTest.jar b/libjava/testsuite/libjava.lang/WalkerTest.jar
new file mode 100644 (file)
index 0000000..64faf04
Binary files /dev/null and b/libjava/testsuite/libjava.lang/WalkerTest.jar differ
diff --git a/libjava/testsuite/libjava.lang/WalkerTest.java b/libjava/testsuite/libjava.lang/WalkerTest.java
new file mode 100644 (file)
index 0000000..f4e41fe
--- /dev/null
@@ -0,0 +1,15 @@
+class Foo
+{
+  Class bar()
+  {
+    return gnu.classpath.VMStackWalker.getCallingClass();
+  }
+}
+
+public class WalkerTest
+{
+  public static void main(String[] argv)
+  {
+    System.out.println(new Foo().bar());
+  }
+}
diff --git a/libjava/testsuite/libjava.lang/WalkerTest.out b/libjava/testsuite/libjava.lang/WalkerTest.out
new file mode 100644 (file)
index 0000000..9b8eb00
--- /dev/null
@@ -0,0 +1 @@
+class WalkerTest