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.25 by jsr166, Wed Nov 17 08:25:53 2010 UTC vs.
Revision 1.26 by jsr166, Thu Nov 18 07:41:41 2010 UTC

# Line 356 | Line 356 | public class Phaser {
356       * @param registrations number to add to both parties and unarrived fields
357       */
358      private int doRegister(int registrations) {
359 <        long adj = (long)registrations; // adjustment to state
360 <        adj |= adj << PARTIES_SHIFT;
361 <        Phaser par = parent;
359 >        // adjustment to state
360 >        long adj = ((long)registrations << PARTIES_SHIFT) | registrations;
361 >        final Phaser parent = this.parent;
362          for (;;) {
363 <            int phase, parties;
364 <            long s = par == null? state : reconcileState();
365 <            if ((phase = (int)(s >>> PHASE_SHIFT)) < 0)
363 >            long s = (parent == null) ? state : reconcileState();
364 >            int phase = (int)(s >>> PHASE_SHIFT);
365 >            if (phase < 0)
366                  return phase;
367 <            if ((parties = (int)s >>> PARTIES_SHIFT) != 0 &&
368 <                ((int)s & UNARRIVED_MASK) == 0)
367 >            int parties = (int)s >>> PARTIES_SHIFT;
368 >            if (parties != 0 && ((int)s & UNARRIVED_MASK) == 0)
369                  internalAwaitAdvance(phase, null); // wait for onAdvance
370              else if (parties + registrations > MAX_PARTIES)
371                  throw new IllegalStateException(badRegister(s));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines