Merge
authormullan
Wed, 22 Jan 2014 10:27:08 -0500
changeset 22564 6fec37edea45
parent 22563 2e5b6242e863 (current diff)
parent 22562 e909d64b8dd8 (diff)
child 22565 2f3102102bd9
Merge
--- a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java	Wed Jan 22 10:27:08 2014 -0500
@@ -110,7 +110,7 @@
             }
         }
 
-        nd.preClose(fd);
+        // signal any threads blocked on this channel
         threads.signalAndWait();
 
         if (parent != null) {
--- a/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java	Wed Jan 22 10:27:08 2014 -0500
@@ -82,8 +82,9 @@
 
     // Signals all threads in this set.
     //
-    void signalAndWait() {
-        synchronized (this) {
+    synchronized void signalAndWait() {
+        boolean interrupted = false;
+        while (used > 0) {
             int u = used;
             int n = elts.length;
             for (int i = 0; i < n; i++) {
@@ -96,16 +97,15 @@
                     break;
             }
             waitingToEmpty = true;
-            boolean interrupted = false;
-            while (used > 0) {
-                try {
-                    wait();
-                } catch (InterruptedException e) {
-                    interrupted = true;
-                }
+            try {
+                wait(50);
+            } catch (InterruptedException e) {
+                interrupted = true;
+            } finally {
+                waitingToEmpty = false;
             }
-            if (interrupted)
-                Thread.currentThread().interrupt();
         }
+        if (interrupted)
+            Thread.currentThread().interrupt();
     }
 }
--- a/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java	Wed Jan 22 10:27:08 2014 -0500
@@ -88,7 +88,6 @@
         invalidateAllLocks();
 
         // signal any threads blocked on this channel
-        nd.preClose(fdObj);
         threads.signalAndWait();
 
         // wait until all async I/O operations have completely gracefully
--- a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	Wed Jan 22 10:27:08 2014 -0500
@@ -32,27 +32,32 @@
 #include "sun_nio_ch_NativeThread.h"
 #include "nio_util.h"
 
-
 #ifdef __linux__
-#include <pthread.h>
-#include <sys/signal.h>
-
-/* Also defined in src/solaris/native/java/net/linux_close.c */
-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+  #include <pthread.h>
+  #include <sys/signal.h>
+  /* Also defined in net/linux_close.c */
+  #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+#elif __solaris__
+  #include <thread.h>
+  #include <signal.h>
+  #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+#elif _ALLBSD_SOURCE
+  #include <pthread.h>
+  #include <signal.h>
+  /* Also defined in net/bsd_close.c */
+  #define INTERRUPT_SIGNAL SIGIO
+#else
+  #error "missing platform-specific definition here"
+#endif
 
 static void
 nullHandler(int sig)
 {
 }
 
-#endif
-
-
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
-
     /* Install the null handler for INTERRUPT_SIGNAL.  This might overwrite the
      * handler previously installed by java/net/linux_close.c, but that's okay
      * since neither handler actually does anything.  We install our own
@@ -67,25 +72,27 @@
     sigemptyset(&sa.sa_mask);
     if (sigaction(INTERRUPT_SIGNAL, &sa, &osa) < 0)
         JNU_ThrowIOExceptionWithLastError(env, "sigaction");
-
-#endif
 }
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
-    return (long)pthread_self();
+#ifdef __solaris__
+    return (jlong)thr_self();
 #else
-    return -1;
+    return (jlong)pthread_self();
 #endif
 }
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
 {
-#ifdef __linux__
-    if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
+    int ret;
+#ifdef __solaris__
+    ret = thr_kill((thread_t)thread, INTERRUPT_SIGNAL);
+#else
+    ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
+#endif
+    if (ret != 0)
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
-#endif
 }
--- a/jdk/test/ProblemList.txt	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/ProblemList.txt	Wed Jan 22 10:27:08 2014 -0500
@@ -173,11 +173,6 @@
 # 6963118
 java/nio/channels/Selector/Wakeup.java                          windows-all
 
-# 7133499, 7133497
-java/nio/channels/AsyncCloseAndInterrupt.java                   macosx-all
-java/nio/channels/AsynchronousFileChannel/Lock.java             macosx-all
-java/nio/channels/FileChannel/Transfer.java                     macosx-all
-
 # 7141822
 java/nio/channels/DatagramChannel/ChangingAddress.java          macosx-all
 
--- a/jdk/test/sun/tools/jstat/classOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/classOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/classloadOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/classloadOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -22,7 +22,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/compilerOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/compilerOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -30,7 +30,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/fileURITest1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/fileURITest1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -22,7 +22,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -30,7 +30,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -22,7 +22,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcOldOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcOldOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -22,7 +22,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/gcOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/gcOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -22,7 +22,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/lineCounts1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/lineCounts1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -25,7 +25,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 5) && (totallines == 6)) {
+	    if ((headerlines == 1) && (datalines == 5)) {
 	        exit 0
             }
             else {
--- a/jdk/test/sun/tools/jstat/lineCounts2.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/lineCounts2.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/lineCounts3.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/lineCounts3.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -30,7 +30,7 @@
 	{ totallines++; print $0 }
 
 END	{ 
-	    if ((headerlines == 1) && (datalines == 10) && (totallines == 11)) {
+	    if ((headerlines == 1) && (datalines == 10)) {
 	        exit 0
 	    } else {
 	        exit 1
--- a/jdk/test/sun/tools/jstat/lineCounts4.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/lineCounts4.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -36,7 +36,7 @@
 	{ totallines++; print $0 }
 
 END	{ 
-	    if ((headerlines == 2) && (datalines == 11) && (totallines == 13) && (datalines2 == 1)) {
+	    if ((headerlines == 2) && (datalines == 11) && (datalines2 == 1)) {
 	        exit 0
 	    } else {
 	        exit 1
--- a/jdk/test/sun/tools/jstat/printCompilationOutput1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/printCompilationOutput1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -25,7 +25,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {
--- a/jdk/test/sun/tools/jstat/timeStamp1.awk	Tue Jan 21 16:54:26 2014 -0500
+++ b/jdk/test/sun/tools/jstat/timeStamp1.awk	Wed Jan 22 10:27:08 2014 -0500
@@ -21,7 +21,7 @@
 	{ totallines++; print $0 }
 
 END	{
-	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	    if ((headerlines == 1) && (datalines == 1)) {
 	        exit 0
 	    }
 	    else {