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

Comparing jsr166/src/jsr166y/ForkJoinTask.java (file contents):
Revision 1.57 by dl, Sat Sep 4 11:33:53 2010 UTC vs.
Revision 1.61 by jsr166, Thu Sep 16 03:57:13 2010 UTC

# Line 153 | Line 153 | public abstract class ForkJoinTask<V> im
153       * single int to minimize footprint and to ensure atomicity (via
154       * CAS).  Status is initially zero, and takes on nonnegative
155       * values until completed, upon which status holds value
156 <     * NORMAL. CANCELLED, or EXCEPTIONAL. Tasks undergoing blocking
156 >     * NORMAL, CANCELLED, or EXCEPTIONAL. Tasks undergoing blocking
157       * waits by other threads have the SIGNAL bit set.  Completion of
158       * a stolen task with SIGNAL set awakens any waiters via
159       * notifyAll. Even though suboptimal for some purposes, we use
# Line 206 | Line 206 | public abstract class ForkJoinTask<V> im
206  
207      /**
208       * Records exception and sets exceptional completion.
209 <     *
209 >     *
210       * @return status on exit
211       */
212      private void setExceptionalCompletion(Throwable rex) {
# Line 223 | Line 223 | public abstract class ForkJoinTask<V> im
223          int s;         // the odd construction reduces lock bias effects
224          while ((s = status) >= 0) {
225              try {
226 <                synchronized(this) {
226 >                synchronized (this) {
227                      if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL))
228                          wait();
229                  }
# Line 243 | Line 243 | public abstract class ForkJoinTask<V> im
243          int s;
244          if ((s = status) >= 0) {
245              try {
246 <                synchronized(this) {
246 >                synchronized (this) {
247                      if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL))
248                          wait(millis, 0);
249                  }
# Line 261 | Line 261 | public abstract class ForkJoinTask<V> im
261      private void externalAwaitDone() {
262          int s;
263          while ((s = status) >= 0) {
264 <            synchronized(this) {
264 >            synchronized (this) {
265                  if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)){
266                      boolean interrupted = false;
267                      while (status >= 0) {
# Line 621 | Line 621 | public abstract class ForkJoinTask<V> im
621  
622      /**
623       * Completes this task, and if not already aborted or cancelled,
624 <     * returning a {@code null} result upon {@code join} and related
625 <     * operations. This method may be used to provide results for
626 <     * asynchronous tasks, or to provide alternative handling for
627 <     * tasks that would not otherwise complete normally. Its use in
628 <     * other situations is discouraged. This method is
629 <     * overridable, but overridden versions must invoke {@code super}
630 <     * implementation to maintain guarantees.
624 >     * returning the given value as the result of subsequent
625 >     * invocations of {@code join} and related operations. This method
626 >     * may be used to provide results for asynchronous tasks, or to
627 >     * provide alternative handling for tasks that would not otherwise
628 >     * complete normally. Its use in other situations is
629 >     * discouraged. This method is overridable, but overridden
630 >     * versions must invoke {@code super} implementation to maintain
631 >     * guarantees.
632       *
633       * @param value the result value for this task
634       */
# Line 679 | Line 680 | public abstract class ForkJoinTask<V> im
680          boolean dec = false; // true if pool count decremented
681          long nanos = unit.toNanos(timeout);
682          for (;;) {
683 <            if (Thread.interrupted() && pool == null) {
683 >            if (pool == null && Thread.interrupted()) {
684                  interrupted = true;
685                  break;
686              }
# Line 697 | Line 698 | public abstract class ForkJoinTask<V> im
698                          long ms = nt / 1000000;
699                          int ns = (int) (nt % 1000000);
700                          try {
701 <                            synchronized(this) {
701 >                            synchronized (this) {
702                                  if (status >= 0)
703                                      wait(ms, ns);
704                              }
# Line 764 | Line 765 | public abstract class ForkJoinTask<V> im
765      /**
766       * Commences performing this task and awaits its completion if
767       * necessary, without returning its result or throwing its
768 <     * exception. This method may be useful when processing
768 <     * collections of tasks when some have been cancelled or otherwise
769 <     * known to have aborted.
768 >     * exception.
769       */
770      public final void quietlyInvoke() {
771          if (status >= 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines