aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm
diff options
context:
space:
mode:
authorzgu <none@none>2013-07-04 06:24:08 -0400
committerzgu <none@none>2013-07-04 06:24:08 -0400
commit49ba5985cd8cbc143406703f96c2806319a11db9 (patch)
tree05385511a8119c5ca77909931da2595785999e44 /src/share/vm
parent5d0c0025394aa0e9fb67e7461ada410f8ee32460 (diff)
8016074: NMT: assertion failed: assert(thread->thread_state() == from) failed: coming from wrong thread state
Summary: Uses os::NakedYield() on Solaris instead of os::yield_all() Reviewed-by: acorn, coleenp, hseigel
Diffstat (limited to 'src/share/vm')
-rw-r--r--src/share/vm/services/memTracker.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/share/vm/services/memTracker.hpp b/src/share/vm/services/memTracker.hpp
index dc7b78859..364c6b4f2 100644
--- a/src/share/vm/services/memTracker.hpp
+++ b/src/share/vm/services/memTracker.hpp
@@ -470,7 +470,21 @@ class MemTracker : AllStatic {
static void check_NMT_load(Thread* thr) {
assert(thr != NULL, "Sanity check");
if (_slowdown_calling_thread && thr != _worker_thread) {
+#ifdef _WINDOWS
+ // On Windows, os::NakedYield() does not work as well
+ // as os::yield_all()
os::yield_all();
+#else
+ // On Solaris, os::yield_all() depends on os::sleep()
+ // which requires JavaTherad in _thread_in_vm state.
+ // Transits thread to _thread_in_vm state can be dangerous
+ // if caller holds lock, as it may deadlock with Threads_lock.
+ // So use NaKedYield instead.
+ //
+ // Linux and BSD, NakedYield() and yield_all() implementations
+ // are the same.
+ os::NakedYield();
+#endif
}
}