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.14 by jsr166, Wed Jul 22 20:55:22 2009 UTC vs.
Revision 1.15 by jsr166, Thu Jul 23 19:25:45 2009 UTC

# Line 517 | Line 517 | public class ForkJoinWorkerThread extend
517          if (q == null)
518              return null;
519          int mask = q.length - 1;
520 <        int i = locallyFifo? base : (sp - 1);
520 >        int i = locallyFifo ? base : (sp - 1);
521          return q[i & mask];
522      }
523  
# Line 580 | Line 580 | public class ForkJoinWorkerThread extend
580                      ForkJoinWorkerThread v = ws[mask & idx];
581                      if (v == null || v.sp == v.base) {
582                          if (probes <= mask)
583 <                            idx = (probes++ < 0)? r : (idx + 1);
583 >                            idx = (probes++ < 0) ? r : (idx + 1);
584                          else
585                              break;
586                      }
# Line 601 | Line 601 | public class ForkJoinWorkerThread extend
601       * @return a task, if available
602       */
603      final ForkJoinTask<?> pollTask() {
604 <        ForkJoinTask<?> t = locallyFifo? deqTask() : popTask();
604 >        ForkJoinTask<?> t = locallyFifo ? deqTask() : popTask();
605          if (t == null && (t = scan()) != null)
606              ++stealCount;
607          return t;
# Line 613 | Line 613 | public class ForkJoinWorkerThread extend
613       * @return a task, if available
614       */
615      final ForkJoinTask<?> pollLocalTask() {
616 <        return locallyFifo? deqTask() : popTask();
616 >        return locallyFifo ? deqTask() : popTask();
617      }
618  
619      /**
# Line 693 | Line 693 | public class ForkJoinWorkerThread extend
693       * Returns an estimate of the number of tasks in the queue.
694       */
695      final int getQueueSize() {
696 <        int n = sp - base;
697 <        return n < 0? 0 : n; // suppress momentarily negative values
696 >        // suppress momentarily negative values
697 >        return Math.max(0, sp - base);
698      }
699  
700      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines