# HG changeset patch # User xlu # Date 1231886947 28800 # Node ID 2ddbaf7b8e1c5f1e5f1130ba5e8203d942e53968 # Parent 9250583801d24030cc7e620d40cc5bb83fc4c2df# Parent 52a431267315ebd2439732ff0a35eb59bcd0bed5 Merge diff -r 52a431267315 -r 2ddbaf7b8e1c src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Tue Jan 13 14:41:44 2009 -0500 +++ b/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(); } }