hotspot/src/share/vm/runtime/mutex.cpp
changeset 228 69939fa91efd
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
227:1d53148d4a4c 228:69939fa91efd
  1117 
  1117 
  1118 Monitor::~Monitor() {
  1118 Monitor::~Monitor() {
  1119   assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
  1119   assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
  1120 }
  1120 }
  1121 
  1121 
  1122 void Monitor::ClearMonitor (Monitor * m) {
  1122 void Monitor::ClearMonitor (Monitor * m, const char *name) {
  1123   m->_owner             = NULL ;
  1123   m->_owner             = NULL ;
  1124   m->_snuck             = false ;
  1124   m->_snuck             = false ;
  1125   m->_name              = "UNKNOWN" ;
  1125   if (name == NULL) {
       
  1126     strcpy(m->_name, "UNKNOWN") ;
       
  1127   } else {
       
  1128     strncpy(m->_name, name, MONITOR_NAME_LEN - 1);
       
  1129     m->_name[MONITOR_NAME_LEN - 1] = '\0';
       
  1130   }
  1126   m->_LockWord.FullWord = 0 ;
  1131   m->_LockWord.FullWord = 0 ;
  1127   m->_EntryList         = NULL ;
  1132   m->_EntryList         = NULL ;
  1128   m->_OnDeck            = NULL ;
  1133   m->_OnDeck            = NULL ;
  1129   m->_WaitSet           = NULL ;
  1134   m->_WaitSet           = NULL ;
  1130   m->_WaitLock[0]       = 0 ;
  1135   m->_WaitLock[0]       = 0 ;
  1131 }
  1136 }
  1132 
  1137 
  1133 Monitor::Monitor() { ClearMonitor(this); }
  1138 Monitor::Monitor() { ClearMonitor(this); }
  1134 
  1139 
  1135 Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) {
  1140 Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) {
  1136   ClearMonitor (this) ;
  1141   ClearMonitor (this, name) ;
  1137 #ifdef ASSERT
  1142 #ifdef ASSERT
  1138   _allow_vm_block  = allow_vm_block;
  1143   _allow_vm_block  = allow_vm_block;
  1139   _rank            = Rank ;
  1144   _rank            = Rank ;
  1140 #endif
  1145 #endif
  1141 }
  1146 }
  1143 Mutex::~Mutex() {
  1148 Mutex::~Mutex() {
  1144   assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
  1149   assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
  1145 }
  1150 }
  1146 
  1151 
  1147 Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) {
  1152 Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) {
  1148   ClearMonitor ((Monitor *) this) ;
  1153   ClearMonitor ((Monitor *) this, name) ;
  1149 #ifdef ASSERT
  1154 #ifdef ASSERT
  1150  _allow_vm_block   = allow_vm_block;
  1155  _allow_vm_block   = allow_vm_block;
  1151  _rank             = Rank ;
  1156  _rank             = Rank ;
  1152 #endif
  1157 #endif
  1153 }
  1158 }