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

Comparing jsr166/src/test/loops/UncheckedLockLoops.java (file contents):
Revision 1.3 by jsr166, Sat Aug 1 22:12:59 2009 UTC vs.
Revision 1.4 by jsr166, Thu Oct 29 23:09:08 2009 UTC

# Line 21 | Line 21 | public final class UncheckedLockLoops {
21          int maxThreads = 100;
22          int iters = 10000000;
23  
24 <        if (args.length > 0)
24 >        if (args.length > 0)
25              maxThreads = Integer.parseInt(args[0]);
26  
27          rng.setSeed(3122688L);
# Line 60 | Line 60 | public final class UncheckedLockLoops {
60              System.out.print("NoLock (1 thread)     ");
61          new NoLockLoop().test(v, 1, iters * nthreads);
62          Thread.sleep(10);
63 <
63 >
64          if (print)
65              System.out.print("ReentrantLock         ");
66          new ReentrantLockLoop().test(v, nthreads, iters);
# Line 93 | Line 93 | public final class UncheckedLockLoops {
93              System.out.print("Semaphore             ");
94          new SemaphoreLoop().test(v, nthreads, iters);
95          Thread.sleep(10);
96 <        
96 >
97          if (print)
98              System.out.print("FairSemaphore         ");
99          new FairSemaphoreLoop().test(v, nthreads, fairIters);
# Line 108 | Line 108 | public final class UncheckedLockLoops {
108              System.out.print("FairRWriteLock         ");
109          new FairReentrantWriteLockLoop().test(v, nthreads, fairIters);
110          Thread.sleep(10);
111 <        
111 >
112          if (print)
113              System.out.print("ReentrantReadWriteLock");
114          new ReentrantReadWriteLockLoop().test(v, nthreads, iters);
115          Thread.sleep(10);
116 <        
116 >
117          if (print)
118              System.out.print("FairRReadWriteLock     ");
119          new FairReentrantReadWriteLockLoop().test(v, nthreads, fairIters);
# Line 138 | Line 138 | public final class UncheckedLockLoops {
138  
139          final int getValue() {
140              int v = value;
141 <            if (checkValue != ~(v ^ 0xAAAAAAAA))
141 >            if (checkValue != ~(v ^ 0xAAAAAAAA))
142                  ++failures;
143              return v;
144          }
# Line 147 | Line 147 | public final class UncheckedLockLoops {
147              setValue(initialValue);
148              this.iters = iters;
149              barrier = new CyclicBarrier(nthreads+1, timer);
150 <            for (int i = 0; i < nthreads; ++i)
150 >            for (int i = 0; i < nthreads; ++i)
151                  new Thread(this).start();
152              barrier.await();
153              barrier.await();
# Line 168 | Line 168 | public final class UncheckedLockLoops {
168          abstract int loop(int n);
169          public final void run() {
170              try {
171 <                barrier.await();
171 >                barrier.await();
172                  result += loop(iters);
173                  barrier.await();
174              }
175 <            catch (Exception ie) {
176 <                return;
175 >            catch (Exception ie) {
176 >                return;
177              }
178          }
179  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines