src/share/vm/prims/jvm.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -525,10 +525,16 @@
Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
assert(obj->is_instance() || obj->is_array(), "JVM_MonitorWait must apply to an object");
JavaThreadInObjectWaitState jtiows(thread, ms != 0);
if (JvmtiExport::should_post_monitor_wait()) {
JvmtiExport::post_monitor_wait((JavaThread *)THREAD, (oop)obj(), ms);
+
+ // The current thread already owns the monitor and it has not yet
+ // been added to the wait queue so the current thread cannot be
+ // made the successor. This means that the JVMTI_EVENT_MONITOR_WAIT
+ // event handler cannot accidentally consume an unpark() meant for
+ // the ParkEvent associated with this ObjectMonitor.
}
ObjectSynchronizer::wait(obj, ms, THREAD);
JVM_END