ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/CASLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/CASLoops.java (file contents):
Revision 1.9 by jsr166, Wed Dec 31 17:00:58 2014 UTC vs.
Revision 1.10 by jsr166, Thu Jan 15 18:34:18 2015 UTC

# Line 26 | Line 26
26   * if this program is called with (any) second argument
27   */
28  
29
29   import java.util.concurrent.*;
30   import java.util.concurrent.atomic.AtomicInteger;
31   import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
# Line 115 | Line 114 | public class CASLoops {
114                  valueUpdater = AtomicIntegerFieldUpdater.newUpdater
115                  (UpdaterAtomicInteger.class, "value");
116  
118
117          UpdaterAtomicInteger() {}
118          int get() {
119              return value;
# Line 161 | Line 159 | public class CASLoops {
159          synchronized void set(int val) { value = val; }
160      }
161  
164
162      static final class LockedInteger extends AbstractQueuedSynchronizer {
163          int value;
164          LockedInteger() {}
# Line 537 | Line 534 | public class CASLoops {
534          return timer.getTime();
535      }
536  
540
537      static long runSynched(int n, long iters) throws Exception {
538          LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
539          CyclicBarrier b = new CyclicBarrier(n+1, timer);
# Line 573 | Line 569 | public class CASLoops {
569          System.out.println("\t " + secs + "s run time");
570      }
571  
576
572      static void oneRun(int i, long iters, boolean print) throws Exception {
573          if (print)
574              System.out.println("threads : " + i +
# Line 606 | Line 601 | public class CASLoops {
601              report("Synchronized: ", stime, ntime, i, iters);
602          Thread.sleep(100L);
603      }
609
610
604   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines