ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/CyclicBarrier.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/CyclicBarrier.java (file contents):
Revision 1.19 by dl, Sat Oct 18 12:29:33 2003 UTC vs.
Revision 1.20 by dl, Tue Dec 23 19:38:09 2003 UTC

# Line 142 | Line 142 | public class CyclicBarrier {
142       */
143      private int dowait(boolean timed, long nanos)
144          throws InterruptedException, BrokenBarrierException, TimeoutException {
145 +        final ReentrantLock lock = this.lock;
146          lock.lock();
147          try {
148              int index = --count;
# Line 159 | Line 160 | public class CyclicBarrier {
160                  nextGeneration();
161                  boolean ranAction = false;
162                  try {
163 <                    if (barrierCommand != null)
164 <                        barrierCommand.run();
163 >                    Runnable command = barrierCommand;
164 >                    if (command != null)
165 >                        command.run();
166                      ranAction = true;
167                      return 0;
168                  } finally {
# Line 373 | Line 375 | public class CyclicBarrier {
375       * and <tt>false</tt> otherwise.
376       */
377      public boolean isBroken() {
378 +        final ReentrantLock lock = this.lock;
379          lock.lock();
380          try {
381              return broken;
# Line 391 | Line 394 | public class CyclicBarrier {
394       * instead create a new barrier for subsequent use.
395       */
396      public void reset() {
397 +        final ReentrantLock lock = this.lock;
398          lock.lock();
399          try {
400              /*
# Line 414 | Line 418 | public class CyclicBarrier {
418       * @return the number of parties currently blocked in {@link #await}
419       **/
420      public int getNumberWaiting() {
421 +        final ReentrantLock lock = this.lock;
422          lock.lock();
423          try {
424              return parties - count;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines