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

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.11 by jsr166, Tue Jul 21 00:15:13 2009 UTC vs.
Revision 1.16 by jsr166, Thu Jul 23 19:44:46 2009 UTC

# Line 56 | Line 56 | import java.lang.reflect.*;
56   * maximum number of running threads to 32767. Attempts to create
57   * pools with greater than the maximum result in
58   * IllegalArgumentExceptions.
59 + *
60 + * @since 1.7
61 + * @author Doug Lea
62   */
63   public class ForkJoinPool extends AbstractExecutorService {
64  
# Line 216 | Line 219 | public class ForkJoinPool extends Abstra
219       * threads, packed into one int to ensure consistent snapshot when
220       * making decisions about creating and suspending spare
221       * threads. Updated only by CAS.  Note: CASes in
222 <     * updateRunningCount and preJoin running active count is in low
223 <     * word, so need to be modified if this changes
222 >     * updateRunningCount and preJoin assume that running active count
223 >     * is in low word, so need to be modified if this changes.
224       */
225      private volatile int workerCounts;
226  
# Line 430 | Line 433 | public class ForkJoinPool extends Abstra
433  
434      /**
435       * Creates or resizes array if necessary to hold newLength.
436 <     * Call only under exclusion or lock.
436 >     * Call only under exclusion.
437 >     *
438       * @return the array
439       */
440      private ForkJoinWorkerThread[] ensureWorkerArrayCapacity(int newLength) {
# Line 1818 | Line 1822 | public class ForkJoinPool extends Abstra
1822  
1823      private static long fieldOffset(String fieldName)
1824              throws NoSuchFieldException {
1825 <        return _unsafe.objectFieldOffset
1825 >        return UNSAFE.objectFieldOffset
1826              (ForkJoinPool.class.getDeclaredField(fieldName));
1827      }
1828  
1829 <    static final Unsafe _unsafe;
1829 >    static final Unsafe UNSAFE;
1830      static final long eventCountOffset;
1831      static final long workerCountsOffset;
1832      static final long runControlOffset;
# Line 1831 | Line 1835 | public class ForkJoinPool extends Abstra
1835  
1836      static {
1837          try {
1838 <            _unsafe = getUnsafe();
1838 >            UNSAFE = getUnsafe();
1839              eventCountOffset = fieldOffset("eventCount");
1840              workerCountsOffset = fieldOffset("workerCounts");
1841              runControlOffset = fieldOffset("runControl");
# Line 1843 | Line 1847 | public class ForkJoinPool extends Abstra
1847      }
1848  
1849      private boolean casEventCount(long cmp, long val) {
1850 <        return _unsafe.compareAndSwapLong(this, eventCountOffset, cmp, val);
1850 >        return UNSAFE.compareAndSwapLong(this, eventCountOffset, cmp, val);
1851      }
1852      private boolean casWorkerCounts(int cmp, int val) {
1853 <        return _unsafe.compareAndSwapInt(this, workerCountsOffset, cmp, val);
1853 >        return UNSAFE.compareAndSwapInt(this, workerCountsOffset, cmp, val);
1854      }
1855      private boolean casRunControl(int cmp, int val) {
1856 <        return _unsafe.compareAndSwapInt(this, runControlOffset, cmp, val);
1856 >        return UNSAFE.compareAndSwapInt(this, runControlOffset, cmp, val);
1857      }
1858      private boolean casSpareStack(WaitQueueNode cmp, WaitQueueNode val) {
1859 <        return _unsafe.compareAndSwapObject(this, spareStackOffset, cmp, val);
1859 >        return UNSAFE.compareAndSwapObject(this, spareStackOffset, cmp, val);
1860      }
1861      private boolean casBarrierStack(WaitQueueNode cmp, WaitQueueNode val) {
1862 <        return _unsafe.compareAndSwapObject(this, syncStackOffset, cmp, val);
1862 >        return UNSAFE.compareAndSwapObject(this, syncStackOffset, cmp, val);
1863      }
1864   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines