# HG changeset patch # User xlu # Date 1231877678 28800 # Node ID 45a845bd02d83372e1ca1ab18c4eeaee289816e1 # Parent 6cb9181f6061fc396993fad48d0498371c6e2244# Parent d49193ae5111c4230cd2b04e60a1f53938c8ae8f Merge diff -r 6cb9181f6061 -r 45a845bd02d8 hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Fri Jan 09 14:39:07 2009 -0500 +++ b/hotspot/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(); } }