8366659: Extra check before posting the waited event.

This commit is contained in:
Anton Artemov 2026-01-29 09:45:21 +01:00
parent 6620a88f19
commit c3f934b7ea

View File

@ -1938,8 +1938,10 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
{
ThreadBlockInVM tbvm(current, true);
}
JvmtiExport::post_monitor_waited(current, this, ret == OS_TIMEOUT);
// Re-check the condition as the monitor waited events can be disabled whilst thread was suspended.
if (JvmtiExport::should_post_monitor_waited()) {
JvmtiExport::post_monitor_waited(current, this, ret == OS_TIMEOUT);
}
}
if (wait_event.should_commit()) {