comparison src/share/vm/prims/jni.cpp @ 521:4db4e58c16bd

6791815: Fix for 6471657 can cause deadlock on non-Solaris platforms when initializing direct buffer support Summary: Place the state transition inside the loop so that the VMThread could proceed for safepoint Reviewed-by: dholmes, never, acorn
author xlu
date Tue, 13 Jan 2009 12:08:43 -0800
parents 24fda36852ce
children 0fbdb4381b99
comparison
equal deleted inserted replaced
515:a0401dc51d0b 521:4db4e58c16bd
2689 return false; 2689 return false;
2690 } 2690 }
2691 2691
2692 directBufferSupportInitializeEnded = 1; 2692 directBufferSupportInitializeEnded = 1;
2693 } else { 2693 } else {
2694 ThreadInVMfromNative tivn(thread); // set state as yield_all can call os:sleep
2695 while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) { 2694 while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) {
2695 // Set state as yield_all can call os:sleep. On Solaris, yield_all calls
2696 // os::sleep which requires the VM state transition. On other platforms, it
2697 // is not necessary. The following call to change the VM state is purposely
2698 // put inside the loop to avoid potential deadlock when multiple threads
2699 // try to call this method. See 6791815 for more details.
2700 ThreadInVMfromNative tivn(thread);
2696 os::yield_all(); 2701 os::yield_all();
2697 } 2702 }
2698 } 2703 }
2699 2704
2700 return !directBufferSupportInitializeFailed; 2705 return !directBufferSupportInitializeFailed;