changeset 2538:3f49d30f8184

7034957: acquiring lock CodeCache_lock/1 out of order with lock tty_lock/0 -- possible deadlock Reviewed-by: iveresov
author never
date Thu, 07 Apr 2011 21:32:23 -0700
parents 4124a5a27707
children 8f28c5ab24b3 d86923d96dca 3af54845df98
files src/share/vm/code/codeCache.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/codeCache.cpp	Thu Apr 07 17:12:23 2011 -0700
+++ b/src/share/vm/code/codeCache.cpp	Thu Apr 07 21:32:23 2011 -0700
@@ -971,6 +971,8 @@
   if (CodeCache_lock->owned_by_self()) {
     return _heap->largest_free_block();
   } else {
+    // Avoid lock ordering problems with ttyLock.
+    ttyUnlocker ttyul;
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     return _heap->largest_free_block();
   }