src/share/vm/prims/jni.cpp

Print this page

        

*** 2689,2700 **** return false; } directBufferSupportInitializeEnded = 1; } else { - ThreadInVMfromNative tivn(thread); // set state as yield_all can call os:sleep while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) { os::yield_all(); } } return !directBufferSupportInitializeFailed; --- 2689,2705 ---- return false; } directBufferSupportInitializeEnded = 1; } else { 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 transit 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(); } } return !directBufferSupportInitializeFailed;