< prev index next >

src/share/vm/runtime/mutex.cpp

Print this page
rev 8615 : CMSParallelFullGC: Parallel version of CMS Full GC.

@@ -957,11 +957,12 @@
 // that is guaranteed not to block while running inside the VM. If this is called with
 // thread state set to be in VM, the safepoint synchronization code will deadlock!
 
 void Monitor::lock_without_safepoint_check(Thread * Self) {
   // Ensure that the Monitor does not require or allow safepoint checks.
-  assert(_safepoint_check_required != Monitor::_safepoint_check_always,
+  assert(_safepoint_check_required != Monitor::_safepoint_check_always ||
+         SafepointSynchronize::is_at_safepoint(),
          err_msg("This lock should always have a safepoint check: %s",
                  name()));
   assert(_owner != Self, "invariant");
   ILock(Self);
   assert(_owner == NULL, "invariant");

@@ -1092,11 +1093,12 @@
 bool Monitor::wait(bool no_safepoint_check, long timeout,
                    bool as_suspend_equivalent) {
   // Make sure safepoint checking is used properly.
   assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
          err_msg("This lock should never have a safepoint check: %s", name()));
-  assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
+  assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true)
+         || SafepointSynchronize::is_at_safepoint(),
          err_msg("This lock should always have a safepoint check: %s", name()));
 
   Thread * const Self = Thread::current();
   assert(_owner == Self, "invariant");
   assert(ILocked(), "invariant");
< prev index next >