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.5 by dl, Wed Jun 19 14:55:40 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines