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

Comparing jsr166/src/main/java/util/concurrent/Phaser.java (file contents):
Revision 1.56 by jsr166, Mon Dec 13 00:39:09 2010 UTC vs.
Revision 1.57 by jsr166, Mon Dec 13 02:43:34 2010 UTC

# Line 389 | Line 389 | public class Phaser {
389      private int doRegister(int registrations) {
390          // adjustment to state
391          long adj = ((long)registrations << PARTIES_SHIFT) | registrations;
392 <        Phaser par = parent;
392 >        final Phaser parent = this.parent;
393          int phase;
394          for (;;) {
395              long s = state;
# Line 401 | Line 401 | public class Phaser {
401              else if ((phase = (int)(s >>> PHASE_SHIFT)) < 0)
402                  break;
403              else if (counts != EMPTY) {             // not 1st registration
404 <                if (par == null || reconcileState() == s) {
404 >                if (parent == null || reconcileState() == s) {
405                      if (unarrived == 0)             // wait out advance
406                          root.internalAwaitAdvance(phase, null);
407                      else if (UNSAFE.compareAndSwapLong(this, stateOffset,
# Line 409 | Line 409 | public class Phaser {
409                          break;
410                  }
411              }
412 <            else if (par == null) {                 // 1st root registration
412 >            else if (parent == null) {              // 1st root registration
413                  long next = ((long)phase << PHASE_SHIFT) | adj;
414                  if (UNSAFE.compareAndSwapLong(this, stateOffset, s, next))
415                      break;
# Line 417 | Line 417 | public class Phaser {
417              else {
418                  synchronized (this) {               // 1st sub registration
419                      if (state == s) {               // recheck under lock
420 <                        par.doRegister(1);
420 >                        parent.doRegister(1);
421                          do {                        // force current phase
422                              phase = (int)(root.state >>> PHASE_SHIFT);
423                              // assert phase < 0 || (int)state == EMPTY;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines