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

Comparing jsr166/src/jsr166y/ForkJoinWorkerThread.java (file contents):
Revision 1.51 by jsr166, Mon Sep 20 20:42:37 2010 UTC vs.
Revision 1.52 by dl, Sun Oct 10 11:56:11 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines