mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
6791815: Fix for 6471657 can cause deadlock on non-Solaris platforms when initializing direct buffer support
Place the state transition inside the loop so that the VMThread could proceed for safepoint Reviewed-by: dholmes, never, acorn
This commit is contained in:
parent
9bf4545843
commit
aae30d753f
1 changed files with 6 additions and 1 deletions
|
@ -2691,8 +2691,13 @@ static bool initializeDirectBufferSupport(JNIEnv* env, JavaThread* thread) {
|
||||||
|
|
||||||
directBufferSupportInitializeEnded = 1;
|
directBufferSupportInitializeEnded = 1;
|
||||||
} else {
|
} else {
|
||||||
ThreadInVMfromNative tivn(thread); // set state as yield_all can call os:sleep
|
|
||||||
while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) {
|
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();
|
os::yield_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue