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

Comparing jsr166/src/test/loops/BinaryAsyncAction.java (file contents):
Revision 1.17 by dl, Sat Sep 12 18:11:24 2015 UTC vs.
Revision 1.18 by dl, Sat Sep 12 19:16:16 2015 UTC

# Line 57 | Line 57 | import java.util.concurrent.atomic.*;
57   * </pre>
58   */
59   public abstract class BinaryAsyncAction extends ForkJoinTask<Void> {
60 <
60 >    private volatile int controlState;  
61 >    
62 >    static final AtomicIntegerFieldUpdater<BinaryAsyncAction> controlStateUpdater =      
63 >        AtomicIntegerFieldUpdater.newUpdater(BinaryAsyncAction.class, "controlState");
64 >    
65      /**
66       * Parent to propagate completion; nulled after completion to
67       * avoid retaining entire tree as garbage
# Line 165 | Line 169 | public abstract class BinaryAsyncAction
169              a.sibling = null;
170              a.parent = null;
171              a.completeThis();
172 <            if (p == null || p.markForkJoinTask())
172 >            if (p == null ||  p.compareAndSetControlState(0, 1))
173                  break;
174              try {
175                  p.onComplete(a, s);
# Line 229 | Line 233 | public abstract class BinaryAsyncAction
233          super.reinitialize();
234      }
235  
232 <<<<<<< BinaryAsyncAction.java
233 =======
236      /**
237       * Gets the control state, which is initially zero, or negative if
238       * this task has completed or cancelled. Once negative, the value
# Line 279 | Line 281 | public abstract class BinaryAsyncAction
281      protected final void decrementControlState() {
282          controlStateUpdater.decrementAndGet(this);
283      }
284 < >>>>>>> 1.14
284 >
285  
286   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines