< prev index next >

src/hotspot/share/runtime/objectMonitor.inline.hpp

Print this page




  78 }
  79 
  80 inline bool ObjectMonitor::check(TRAPS) {
  81   if (THREAD != _owner) {
  82     if (THREAD->is_lock_owned((address) _owner)) {
  83       _owner = THREAD;  // regain ownership of inflated monitor
  84       assert (_recursions == 0, "invariant") ;
  85     } else {
  86       check_slow(THREAD);
  87       return false;
  88     }
  89   }
  90   return true;
  91 }
  92 
  93 // return number of threads contending for this monitor
  94 inline jint ObjectMonitor::contentions() const {
  95   return _contentions;
  96 }
  97 



  98 inline void ObjectMonitor::set_owner(void* owner) {
  99   _owner = owner;

 100 }
 101 
 102 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP


  78 }
  79 
  80 inline bool ObjectMonitor::check(TRAPS) {
  81   if (THREAD != _owner) {
  82     if (THREAD->is_lock_owned((address) _owner)) {
  83       _owner = THREAD;  // regain ownership of inflated monitor
  84       assert (_recursions == 0, "invariant") ;
  85     } else {
  86       check_slow(THREAD);
  87       return false;
  88     }
  89   }
  90   return true;
  91 }
  92 
  93 // return number of threads contending for this monitor
  94 inline jint ObjectMonitor::contentions() const {
  95   return _contentions;
  96 }
  97 
  98 // Do NOT set _contentions = 0. There is a race such that _contentions could
  99 // be set while inflating prior to setting _owner
 100 // Just use Atomic::inc/dec and assert 0 when monitor put on free list
 101 inline void ObjectMonitor::set_owner(void* owner) {
 102   _owner = owner;
 103   _recursions = 0;
 104 }
 105 
 106 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP
< prev index next >