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

Comparing jsr166/src/main/java/util/concurrent/CompletableFuture.java (file contents):
Revision 1.45 by jsr166, Wed Feb 6 08:43:48 2013 UTC vs.
Revision 1.46 by dl, Wed Feb 6 13:55:22 2013 UTC

# Line 2982 | Line 2982 | public class CompletableFuture<T> implem
2982       */
2983      public boolean cancel(boolean mayInterruptIfRunning) {
2984          Object r;
2985 <        while ((r = result) == null) {
2986 <            r = new AltResult(new CancellationException());
2987 <            if (UNSAFE.compareAndSwapObject(this, RESULT, null, r)) {
2988 <                postComplete();
2989 <                return true;
2990 <            }
2991 <        }
2992 <        return ((r instanceof AltResult) &&
2993 <                (((AltResult)r).ex instanceof CancellationException));
2985 >        boolean cancelled = (result == null) &&
2986 >            UNSAFE.compareAndSwapObject
2987 >            (this, RESULT, null, new AltResult(new CancellationException()));
2988 >        postComplete();
2989 >        return cancelled ||
2990 >            (((r = result) instanceof AltResult) &&
2991 >             (((AltResult)r).ex instanceof CancellationException));
2992      }
2993  
2994      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines