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

Comparing jsr166/src/test/loops/CheckedLockLoops.java (file contents):
Revision 1.7 by jsr166, Mon Sep 27 19:15:15 2010 UTC vs.
Revision 1.12 by jsr166, Sat Dec 31 18:54:28 2016 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6   /*
7   * @test
8   * @summary basic safety and liveness of ReentrantLocks, and other locks based on them
9   */
10  
11 < import java.util.concurrent.*;
12 < import java.util.concurrent.locks.*;
13 < import java.util.*;
11 > import java.util.concurrent.Callable;
12 > import java.util.concurrent.CyclicBarrier;
13 > import java.util.concurrent.ExecutorService;
14 > import java.util.concurrent.Executors;
15 > import java.util.concurrent.Semaphore;
16 > import java.util.concurrent.locks.Lock;
17 > import java.util.concurrent.locks.ReentrantLock;
18 > import java.util.concurrent.locks.ReentrantReadWriteLock;
19  
20   public final class CheckedLockLoops {
21      static final ExecutorService pool = Executors.newCachedThreadPool();
# Line 31 | Line 36 | public final class CheckedLockLoops {
36  
37      static void runTest(int maxThreads, int iters) throws Exception {
38          print = true;
39 <        int k = 1;
35 <        for (int i = 1; i <= maxThreads;) {
39 >        for (int k = 1, i = 1; i <= maxThreads;) {
40              System.out.println("Threads:" + i);
41              oneTest(i, iters / i);
42              if (i == k) {
# Line 399 | Line 403 | public final class CheckedLockLoops {
403  
404      }
405  
402
406      private static class FairReentrantReadWriteLockLoop extends LockLoop {
407          private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
408          final int loop(int n) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines