SyncTest.java (run): Cache .class value.
authorJeff Sturm <jsturm@one-point.com>
Wed, 9 Jul 2003 21:07:42 +0000 (21:07 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 9 Jul 2003 21:07:42 +0000 (21:07 +0000)
2003-07-09  Jeff Sturm  <jsturm@one-point.com>

* libjava.lang/SyncTest.java (run): Cache .class value.

From-SVN: r69153

libjava/testsuite/ChangeLog
libjava/testsuite/libjava.lang/SyncTest.java

index ac9493bd357ddbdb7b1a76a850655a381b3dadbb..1771b13dda4514faf489663ecf923e33da71735f 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-09  Jeff Sturm  <jsturm@one-point.com>
+
+       * libjava.lang/SyncTest.java (run): Cache .class value.
+
 2003-06-08  Roger Sayle  <roger@eyesopen.com>
 
        * libjava.lang/MathBuiltin.java: New test case.
index 7cb6a56d3973105e64b5169e3bfba38cc80d0156..85573f8a4b958f196b0942b546cee02fc5aed430 100644 (file)
@@ -3,8 +3,11 @@ public class SyncTest implements Runnable {
   static int counter;
 
   public void run() {
+    // We cache the .class value; otherwise this code is
+    // slow enough that it will time out in some situations.
+    Object lock = SyncTest.class;
     for (int n = 0; n < 1000000; n++)
-      synchronized (SyncTest.class) {
+      synchronized (lock) {
         counter++;
       }
   }