changeset 522:9250583801d2

Merge
author xlu
date Tue, 13 Jan 2009 12:14:38 -0800
parents fc7ab6287598 (current diff) 4db4e58c16bd (diff)
children 2ddbaf7b8e1c
files
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/jni.cpp	Fri Jan 09 14:39:07 2009 -0500
+++ b/src/share/vm/prims/jni.cpp	Tue Jan 13 12:14:38 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();
     }
   }