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

Comparing jsr166/src/test/loops/CancelledLockLoops.java (file contents):
Revision 1.5 by jsr166, Mon Nov 2 23:42:46 2009 UTC vs.
Revision 1.11 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 < import java.util.concurrent.*;
8 < import java.util.concurrent.locks.*;
9 < import java.util.*;
7 > import java.util.Arrays;
8 > import java.util.Collections;
9 > import java.util.Random;
10 > import java.util.concurrent.BrokenBarrierException;
11 > import java.util.concurrent.CyclicBarrier;
12 > import java.util.concurrent.locks.ReentrantLock;
13  
14   public final class CancelledLockLoops {
15      static final Random rng = new Random();
# Line 51 | Line 54 | public final class CancelledLockLoops {
54                  threads[i] = new Thread(this);
55              for (int i = 0; i < threads.length; ++i)
56                  threads[i].start();
57 <            Thread[] cancels = (Thread[]) (threads.clone());
57 >            Thread[] cancels = threads.clone();
58              Collections.shuffle(Arrays.asList(cancels), rng);
59              barrier.await();
60              Thread.sleep(TIMEOUT);
# Line 64 | Line 67 | public final class CancelledLockLoops {
67              barrier.await();
68              if (print) {
69                  long time = timer.getTime();
70 <                double secs = (double)(time) / 1000000000.0;
70 >                double secs = (double) time / 1000000000.0;
71                  System.out.println("\t " + secs + "s run time");
72              }
73  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines