< prev index next >

src/share/vm/runtime/mutex.cpp

Print this page
rev 13203 : [mq]: 8183925


1372     } else {
1373       prev->_next = _next;
1374     }
1375     _next = NULL;
1376 #endif
1377   }
1378 }
1379 
1380 
1381 // Factored out common sanity checks for locking mutex'es. Used by lock() and try_lock()
1382 void Monitor::check_prelock_state(Thread *thread) {
1383   assert((!thread->is_Java_thread() || ((JavaThread *)thread)->thread_state() == _thread_in_vm)
1384          || rank() == Mutex::special, "wrong thread state for using locks");
1385   if (StrictSafepointChecks) {
1386     if (thread->is_VM_thread() && !allow_vm_block()) {
1387       fatal("VM thread using lock %s (not allowed to block on)", name());
1388     }
1389     debug_only(if (rank() != Mutex::special) \
1390                thread->check_for_valid_safepoint_state(false);)
1391   }
1392   if (thread->is_Watcher_thread()) {
1393     assert(!WatcherThread::watcher_thread()->has_crash_protection(),
1394            "locking not allowed when crash protection is set");
1395   }
1396 }
1397 
1398 void Monitor::check_block_state(Thread *thread) {
1399   if (!_allow_vm_block && thread->is_VM_thread()) {
1400     warning("VM thread blocked on lock");
1401     print();
1402     BREAKPOINT;
1403   }
1404   assert(_owner != thread, "deadlock: blocking on monitor owned by current thread");
1405 }
1406 
1407 #endif // PRODUCT


1372     } else {
1373       prev->_next = _next;
1374     }
1375     _next = NULL;
1376 #endif
1377   }
1378 }
1379 
1380 
1381 // Factored out common sanity checks for locking mutex'es. Used by lock() and try_lock()
1382 void Monitor::check_prelock_state(Thread *thread) {
1383   assert((!thread->is_Java_thread() || ((JavaThread *)thread)->thread_state() == _thread_in_vm)
1384          || rank() == Mutex::special, "wrong thread state for using locks");
1385   if (StrictSafepointChecks) {
1386     if (thread->is_VM_thread() && !allow_vm_block()) {
1387       fatal("VM thread using lock %s (not allowed to block on)", name());
1388     }
1389     debug_only(if (rank() != Mutex::special) \
1390                thread->check_for_valid_safepoint_state(false);)
1391   }
1392   assert(!os::ThreadCrashProtection::is_crash_protected(thread),

1393            "locking not allowed when crash protection is set");

1394 }
1395 
1396 void Monitor::check_block_state(Thread *thread) {
1397   if (!_allow_vm_block && thread->is_VM_thread()) {
1398     warning("VM thread blocked on lock");
1399     print();
1400     BREAKPOINT;
1401   }
1402   assert(_owner != thread, "deadlock: blocking on monitor owned by current thread");
1403 }
1404 
1405 #endif // PRODUCT
< prev index next >