aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/prims/jni.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/prims/jni.cpp')
-rw-r--r--src/share/vm/prims/jni.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/share/vm/prims/jni.cpp b/src/share/vm/prims/jni.cpp
index b4a82b9e5..e3f715dd2 100644
--- a/src/share/vm/prims/jni.cpp
+++ b/src/share/vm/prims/jni.cpp
@@ -2691,8 +2691,13 @@ static bool initializeDirectBufferSupport(JNIEnv* env, JavaThread* thread) {
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();
}
}