8220478: java/util/concurrent/ConcurrentHashMap/ToArray.java timed out intermittently
authordl
Fri, 24 May 2019 08:51:04 -0700
changeset 55035 3a30c73838f6
parent 55034 f46be958c4ac
child 55036 265b110fc022
8220478: java/util/concurrent/ConcurrentHashMap/ToArray.java timed out intermittently 8223379: Clarify ForkJoinPool.getStealCount() javadoc Reviewed-by: martin
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Fri May 24 08:47:39 2019 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Fri May 24 08:51:04 2019 -0700
@@ -867,8 +867,8 @@
                     growArray(true);
                 else {
                     phase = 0; // full volatile unlock
-                    if (a[m & (s - 1)] == null)
-                        signal = true;   // was empty
+                    if (((s - base) & ~1) == 0) // size 0 or 1
+                        signal = true;
                 }
             }
             return signal;
@@ -2667,13 +2667,13 @@
     }
 
     /**
-     * Returns an estimate of the total number of tasks stolen from
-     * one thread's work queue by another. The reported value
-     * underestimates the actual total number of steals when the pool
-     * is not quiescent. This value may be useful for monitoring and
-     * tuning fork/join programs: in general, steal counts should be
-     * high enough to keep threads busy, but low enough to avoid
-     * overhead and contention across threads.
+     * Returns an estimate of the total number of completed tasks that
+     * were executed by a thread other than their submitter. The
+     * reported value underestimates the actual total number of steals
+     * when the pool is not quiescent. This value may be useful for
+     * monitoring and tuning fork/join programs: in general, steal
+     * counts should be high enough to keep threads busy, but low
+     * enough to avoid overhead and contention across threads.
      *
      * @return the number of steals
      */