8332360: JVM hangs at exit when running on a uniprocessor

Reviewed-by: dholmes, dcubed, shade
This commit is contained in:
Coleen Phillimore 2024-05-22 12:08:33 +00:00
parent c3bc23fe48
commit 4f1a10f84b

View File

@ -987,6 +987,13 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) {
guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant");
assert(owner_raw() != current, "invariant");
// This thread has been notified so try to reacquire the lock.
if (TryLock(current) == TryLockResult::Success) {
break;
}
// If that fails, spin again. Note that spin count may be zero so the above TryLock
// is necessary.
if (TrySpin(current)) {
break;
}