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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinWorkerThread.java (file contents):
Revision 1.31 by jsr166, Mon Sep 20 20:42:37 2010 UTC vs.
Revision 1.32 by dl, Sun Oct 10 11:55:39 2010 UTC

# Line 935 | Line 935 | public class ForkJoinWorkerThread extend
935          // currentJoin only written by this thread; only need ordered store
936          ForkJoinTask<?> prevJoin = currentJoin;
937          UNSAFE.putOrderedObject(this, currentJoinOffset, joinMe);
938 <        if (sp != base)
939 <            localHelpJoinTask(joinMe);
940 <        if (joinMe.status >= 0)
941 <            pool.awaitJoin(joinMe, this);
938 >        if (isTerminating())                // cancel if shutting down
939 >            joinMe.cancelIgnoringExceptions();
940 >        else {
941 >            if (sp != base)
942 >                localHelpJoinTask(joinMe);
943 >            if (joinMe.status >= 0)
944 >                pool.awaitJoin(joinMe, this);
945 >        }
946          UNSAFE.putOrderedObject(this, currentJoinOffset, prevJoin);
947      }
948  
# Line 976 | Line 980 | public class ForkJoinWorkerThread extend
980      }
981  
982      /**
983 <     * Unless terminating, tries to locate and help perform tasks for
984 <     * a stealer of the given task, or in turn one of its stealers.
985 <     * Traces currentSteal->currentJoin links looking for a thread
986 <     * working on a descendant of the given task and with a non-empty
987 <     * queue to steal back and execute tasks from.
983 >     * Tries to locate and help perform tasks for a stealer of the
984 >     * given task, or in turn one of its stealers.  Traces
985 >     * currentSteal->currentJoin links looking for a thread working on
986 >     * a descendant of the given task and with a non-empty queue to
987 >     * steal back and execute tasks from.
988       *
989       * The implementation is very branchy to cope with potential
990       * inconsistencies or loops encountering chains that are stale,
# Line 996 | Line 1000 | public class ForkJoinWorkerThread extend
1000          int n;
1001          if (joinMe.status < 0)                // already done
1002              return;
999        if ((runState & TERMINATING) != 0) {  // cancel if shutting down
1000            joinMe.cancelIgnoringExceptions();
1001            return;
1002        }
1003          if ((ws = pool.workers) == null || (n = ws.length) <= 1)
1004              return;                           // need at least 2 workers
1005  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines