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

Comparing jsr166/src/jsr166e/ForkJoinWorkerThread.java (file contents):
Revision 1.4 by dl, Wed Nov 21 19:54:32 2012 UTC vs.
Revision 1.6 by jsr166, Sun Jan 18 20:17:33 2015 UTC

# Line 14 | Line 14 | package jsr166e;
14   * scheduling or execution.  However, you can override initialization
15   * and termination methods surrounding the main task processing loop.
16   * If you do create such a subclass, you will also need to supply a
17 < * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to use it
18 < * in a {@code ForkJoinPool}.
17 > * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to
18 > * {@linkplain ForkJoinPool#ForkJoinPool use it} in a {@code ForkJoinPool}.
19   *
20   * @since 1.7
21   * @author Doug Lea
# Line 60 | Line 60 | public class ForkJoinWorkerThread extend
60      }
61  
62      /**
63 <     * Returns the index number of this thread in its pool.  The
64 <     * returned value ranges from zero to the maximum number of
65 <     * threads (minus one) that have ever been created in the pool.
66 <     * This method may be useful for applications that track status or
67 <     * collect results per-worker rather than per-task.
63 >     * Returns the unique index number of this thread in its pool.
64 >     * The returned value ranges from zero to the maximum number of
65 >     * threads (minus one) that may exist in the pool, and does not
66 >     * change during the lifetime of the thread.  This method may be
67 >     * useful for applications that track status or collect results
68 >     * per-worker-thread rather than per-task.
69       *
70       * @return the index number
71       */
72      public int getPoolIndex() {
73 <        return workQueue.poolIndex;
73 >        return workQueue.poolIndex >>> 1; // ignore odd/even tag bit
74      }
75  
76      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines