src/hotspot/share/prims/jvmtiRawMonitor.cpp
changeset 51702 ebd5b1ad971a
parent 50429 83aec1d357d4
child 54469 8592226f5cd3
equal deleted inserted replaced
51701:9012aeaf993b 51702:ebd5b1ad971a
   262   return OS_OK ;
   262   return OS_OK ;
   263 }
   263 }
   264 
   264 
   265 // Any JavaThread will enter here with state _thread_blocked
   265 // Any JavaThread will enter here with state _thread_blocked
   266 int JvmtiRawMonitor::raw_enter(TRAPS) {
   266 int JvmtiRawMonitor::raw_enter(TRAPS) {
   267   TEVENT (raw_enter) ;
       
   268   void * Contended ;
   267   void * Contended ;
   269 
   268 
   270   // don't enter raw monitor if thread is being externally suspended, it will
   269   // don't enter raw monitor if thread is being externally suspended, it will
   271   // surprise the suspender if a "suspended" thread can still enter monitor
   270   // surprise the suspender if a "suspended" thread can still enter monitor
   272   JavaThread * jt = (JavaThread *)THREAD;
   271   JavaThread * jt = (JavaThread *)THREAD;
   339 }
   338 }
   340 
   339 
   341 // Used mainly for JVMTI raw monitor implementation
   340 // Used mainly for JVMTI raw monitor implementation
   342 // Also used for JvmtiRawMonitor::wait().
   341 // Also used for JvmtiRawMonitor::wait().
   343 int JvmtiRawMonitor::raw_exit(TRAPS) {
   342 int JvmtiRawMonitor::raw_exit(TRAPS) {
   344   TEVENT (raw_exit) ;
       
   345   if (THREAD != _owner) {
   343   if (THREAD != _owner) {
   346     return OM_ILLEGAL_MONITOR_STATE;
   344     return OM_ILLEGAL_MONITOR_STATE;
   347   }
   345   }
   348   if (_recursions > 0) {
   346   if (_recursions > 0) {
   349     --_recursions ;
   347     --_recursions ;
   358 
   356 
   359 // Used for JVMTI raw monitor implementation.
   357 // Used for JVMTI raw monitor implementation.
   360 // All JavaThreads will enter here with state _thread_blocked
   358 // All JavaThreads will enter here with state _thread_blocked
   361 
   359 
   362 int JvmtiRawMonitor::raw_wait(jlong millis, bool interruptible, TRAPS) {
   360 int JvmtiRawMonitor::raw_wait(jlong millis, bool interruptible, TRAPS) {
   363   TEVENT (raw_wait) ;
       
   364   if (THREAD != _owner) {
   361   if (THREAD != _owner) {
   365     return OM_ILLEGAL_MONITOR_STATE;
   362     return OM_ILLEGAL_MONITOR_STATE;
   366   }
   363   }
   367 
   364 
   368   // To avoid spurious wakeups we reset the parkevent -- This is strictly optional.
   365   // To avoid spurious wakeups we reset the parkevent -- This is strictly optional.
   404   }
   401   }
   405   return OM_OK ;
   402   return OM_OK ;
   406 }
   403 }
   407 
   404 
   408 int JvmtiRawMonitor::raw_notify(TRAPS) {
   405 int JvmtiRawMonitor::raw_notify(TRAPS) {
   409   TEVENT (raw_notify) ;
       
   410   if (THREAD != _owner) {
   406   if (THREAD != _owner) {
   411     return OM_ILLEGAL_MONITOR_STATE;
   407     return OM_ILLEGAL_MONITOR_STATE;
   412   }
   408   }
   413   SimpleNotify (THREAD, false) ;
   409   SimpleNotify (THREAD, false) ;
   414   return OM_OK;
   410   return OM_OK;
   415 }
   411 }
   416 
   412 
   417 int JvmtiRawMonitor::raw_notifyAll(TRAPS) {
   413 int JvmtiRawMonitor::raw_notifyAll(TRAPS) {
   418   TEVENT (raw_notifyAll) ;
       
   419   if (THREAD != _owner) {
   414   if (THREAD != _owner) {
   420     return OM_ILLEGAL_MONITOR_STATE;
   415     return OM_ILLEGAL_MONITOR_STATE;
   421   }
   416   }
   422   SimpleNotify (THREAD, true) ;
   417   SimpleNotify (THREAD, true) ;
   423   return OM_OK;
   418   return OM_OK;