|
|
c2cb23 |
# HG changeset patch
|
|
|
c2cb23 |
# User dl
|
|
|
c2cb23 |
# Date 1429882781 -7200
|
|
|
c2cb23 |
# Fri Apr 24 15:39:41 2015 +0200
|
|
|
c2cb23 |
# Node ID 948ef7cac69115d4f36ddf1c5293acbe8e14e0a9
|
|
|
c2cb23 |
# Parent adf1b3700c5ba6c13eb8f9d8eb4d6d32085bd483
|
|
|
c2cb23 |
8078490, PR2431, RH1213280: Missed submissions in ForkJoinPool
|
|
|
c2cb23 |
Reviewed-by: psandoz, shade, martin, chegar
|
|
|
c2cb23 |
|
|
|
c2cb23 |
diff -r adf1b3700c5b -r 948ef7cac691 src/share/classes/java/util/concurrent/ForkJoinPool.java
|
|
|
c2cb23 |
--- openjdk/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Wed Jun 17 00:37:45 2015 +0100
|
|
|
c2cb23 |
+++ openjdk/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Fri Apr 24 15:39:41 2015 +0200
|
|
|
c2cb23 |
@@ -2406,7 +2406,7 @@
|
|
|
c2cb23 |
int j = ((am & s) << ASHIFT) + ABASE;
|
|
|
c2cb23 |
U.putOrderedObject(a, j, task);
|
|
|
c2cb23 |
U.putOrderedInt(q, QTOP, s + 1);
|
|
|
c2cb23 |
- U.putOrderedInt(q, QLOCK, 0);
|
|
|
c2cb23 |
+ U.putIntVolatile(q, QLOCK, 0);
|
|
|
c2cb23 |
if (n <= 1)
|
|
|
c2cb23 |
signalWork(ws, q);
|
|
|
c2cb23 |
return;
|
|
|
c2cb23 |
diff -r adf1b3700c5b -r 948ef7cac691 test/java/util/concurrent/forkjoin/SubmissionTest.java
|
|
|
c2cb23 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
c2cb23 |
+++ openjdk/jdk/test/java/util/concurrent/forkjoin/SubmissionTest.java Fri Apr 24 15:39:41 2015 +0200
|
|
|
c2cb23 |
@@ -0,0 +1,49 @@
|
|
|
c2cb23 |
+/*
|
|
|
c2cb23 |
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
|
c2cb23 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
c2cb23 |
+ *
|
|
|
c2cb23 |
+ * This code is free software; you can redistribute it and/or modify it
|
|
|
c2cb23 |
+ * under the terms of the GNU General Public License version 2 only, as
|
|
|
c2cb23 |
+ * published by the Free Software Foundation.
|
|
|
c2cb23 |
+ *
|
|
|
c2cb23 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
c2cb23 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
c2cb23 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
c2cb23 |
+ * version 2 for more details (a copy is included in the LICENSE file that
|
|
|
c2cb23 |
+ * accompanied this code).
|
|
|
c2cb23 |
+ *
|
|
|
c2cb23 |
+ * You should have received a copy of the GNU General Public License version
|
|
|
c2cb23 |
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
c2cb23 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
c2cb23 |
+ *
|
|
|
c2cb23 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
c2cb23 |
+ * or visit www.oracle.com if you need additional information or have any
|
|
|
c2cb23 |
+ * questions.
|
|
|
c2cb23 |
+ */
|
|
|
c2cb23 |
+
|
|
|
c2cb23 |
+import java.util.concurrent.ForkJoinPool;
|
|
|
c2cb23 |
+import java.util.concurrent.TimeUnit;
|
|
|
c2cb23 |
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
c2cb23 |
+
|
|
|
c2cb23 |
+/*
|
|
|
c2cb23 |
+ * @test
|
|
|
c2cb23 |
+ * @bug 8078490
|
|
|
c2cb23 |
+ * @summary Test submission and execution of task without joining
|
|
|
c2cb23 |
+ */
|
|
|
c2cb23 |
+public class SubmissionTest {
|
|
|
c2cb23 |
+ public static void main(String[] args) throws Throwable {
|
|
|
c2cb23 |
+ final ForkJoinPool e = new ForkJoinPool(1);
|
|
|
c2cb23 |
+ final AtomicBoolean b = new AtomicBoolean();
|
|
|
c2cb23 |
+ final Runnable setFalse = () -> b.set(false);
|
|
|
c2cb23 |
+ for (int i = 0; i < 100000; i++) {
|
|
|
c2cb23 |
+ b.set(true);
|
|
|
c2cb23 |
+ e.execute(setFalse);
|
|
|
c2cb23 |
+ long st = System.nanoTime();
|
|
|
c2cb23 |
+ while (b.get()) {
|
|
|
c2cb23 |
+ if (System.nanoTime() - st >= TimeUnit.SECONDS.toNanos(10)) {
|
|
|
c2cb23 |
+ throw new RuntimeException("Submitted task failed to execute");
|
|
|
c2cb23 |
+ }
|
|
|
c2cb23 |
+ }
|
|
|
c2cb23 |
+ }
|
|
|
c2cb23 |
+ }
|
|
|
c2cb23 |
+}
|