< prev index next >

src/hotspot/share/runtime/mutex.cpp

Print this page
rev 52886 : imported patch new_rank


1059                    bool as_suspend_equivalent) {
1060   // Make sure safepoint checking is used properly.
1061   assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
1062          "This lock should never have a safepoint check: %s", name());
1063   assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
1064          "This lock should always have a safepoint check: %s", name());
1065 
1066   Thread * const Self = Thread::current();
1067   assert(_owner == Self, "invariant");
1068   assert(ILocked(), "invariant");
1069 
1070   // as_suspend_equivalent logically implies !no_safepoint_check
1071   guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
1072   // !no_safepoint_check logically implies java_thread
1073   guarantee(no_safepoint_check || Self->is_Java_thread(), "invariant");
1074 
1075   #ifdef ASSERT
1076   Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks());
1077   assert(least != this, "Specification of get_least_... call above");
1078   if (least != NULL && least->rank() <= special) {
1079     tty->print("Attempting to wait on monitor %s/%d while holding"
1080                " lock %s/%d -- possible deadlock",
1081                name(), rank(), least->name(), least->rank());
1082     assert(false, "Shouldn't block(wait) while holding a lock of rank special");
1083   }
1084   #endif // ASSERT
1085 
1086   int wait_status;
1087   // conceptually set the owner to NULL in anticipation of
1088   // abdicating the lock in wait
1089   set_owner(NULL);
1090   if (no_safepoint_check) {
1091     wait_status = IWait(Self, timeout);
1092   } else {
1093     assert(Self->is_Java_thread(), "invariant");
1094     JavaThread *jt = (JavaThread *)Self;
1095 
1096     // Enter safepoint region - ornate and Rococo ...
1097     ThreadBlockInVM tbivm(jt);
1098     OSThreadWaitState osts(Self->osthread(), false /* not Object.wait() */);
1099 




1059                    bool as_suspend_equivalent) {
1060   // Make sure safepoint checking is used properly.
1061   assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
1062          "This lock should never have a safepoint check: %s", name());
1063   assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
1064          "This lock should always have a safepoint check: %s", name());
1065 
1066   Thread * const Self = Thread::current();
1067   assert(_owner == Self, "invariant");
1068   assert(ILocked(), "invariant");
1069 
1070   // as_suspend_equivalent logically implies !no_safepoint_check
1071   guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
1072   // !no_safepoint_check logically implies java_thread
1073   guarantee(no_safepoint_check || Self->is_Java_thread(), "invariant");
1074 
1075   #ifdef ASSERT
1076   Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks());
1077   assert(least != this, "Specification of get_least_... call above");
1078   if (least != NULL && least->rank() <= special) {
1079     ::tty->print("Attempting to wait on monitor %s/%d while holding"
1080                  " lock %s/%d -- possible deadlock",
1081                  name(), rank(), least->name(), least->rank());
1082     assert(false, "Shouldn't block(wait) while holding a lock of rank special");
1083   }
1084   #endif // ASSERT
1085 
1086   int wait_status;
1087   // conceptually set the owner to NULL in anticipation of
1088   // abdicating the lock in wait
1089   set_owner(NULL);
1090   if (no_safepoint_check) {
1091     wait_status = IWait(Self, timeout);
1092   } else {
1093     assert(Self->is_Java_thread(), "invariant");
1094     JavaThread *jt = (JavaThread *)Self;
1095 
1096     // Enter safepoint region - ornate and Rococo ...
1097     ThreadBlockInVM tbivm(jt);
1098     OSThreadWaitState osts(Self->osthread(), false /* not Object.wait() */);
1099 


< prev index next >