Merge
authorxlu
Tue, 13 Jan 2009 14:49:07 -0800
changeset 1899 3e96eebdcac5
parent 1898 45a845bd02d8 (diff)
parent 1896 cce23a9ff495 (current diff)
child 1900 68ea5d5fab8b
Merge
--- a/hotspot/src/share/vm/prims/jni.cpp	Tue Jan 13 14:41:44 2009 -0500
+++ b/hotspot/src/share/vm/prims/jni.cpp	Tue Jan 13 14:49:07 2009 -0800
@@ -2691,8 +2691,13 @@
 
     directBufferSupportInitializeEnded = 1;
   } else {
-    ThreadInVMfromNative tivn(thread); // set state as yield_all can call os:sleep
     while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) {
+      // Set state as yield_all can call os:sleep. On Solaris, yield_all calls
+      // os::sleep which requires the VM state transition. On other platforms, it
+      // is not necessary. The following call to change the VM state is purposely
+      // put inside the loop to avoid potential deadlock when multiple threads
+      // try to call this method. See 6791815 for more details.
+      ThreadInVMfromNative tivn(thread);
       os::yield_all();
     }
   }