< prev index next >

src/share/vm/runtime/mutex.hpp

Print this page
rev 12906 : [mq]: gc_interface


  87 static const int MONITOR_NAME_LEN = 64;
  88 
  89 class Monitor : public CHeapObj<mtInternal> {
  90 
  91  public:
  92   // A special lock: Is a lock where you are guaranteed not to block while you are
  93   // holding it, i.e., no vm operation can happen, taking other locks, etc.
  94   // NOTE: It is critical that the rank 'special' be the lowest (earliest)
  95   // (except for "event"?) for the deadlock detection to work correctly.
  96   // The rank native is only for use in Mutex's created by JVM_RawMonitorCreate,
  97   // which being external to the VM are not subject to deadlock detection.
  98   // The rank safepoint is used only for synchronization in reaching a
  99   // safepoint and leaving a safepoint.  It is only used for the Safepoint_lock
 100   // currently.  While at a safepoint no mutexes of rank safepoint are held
 101   // by any thread.
 102   // The rank named "leaf" is probably historical (and should
 103   // be changed) -- mutexes of this rank aren't really leaf mutexes
 104   // at all.
 105   enum lock_types {
 106        event,
 107        special,
 108        suspend_resume,
 109        leaf        = suspend_resume +   2,
 110        safepoint   = leaf           +  10,
 111        barrier     = safepoint      +   1,
 112        nonleaf     = barrier        +   1,
 113        max_nonleaf = nonleaf        + 900,
 114        native      = max_nonleaf    +   1
 115   };
 116 
 117   // The WaitSet and EntryList linked lists are composed of ParkEvents.
 118   // I use ParkEvent instead of threads as ParkEvents are immortal and
 119   // type-stable, meaning we can safely unpark() a possibly stale
 120   // list element in the unlock()-path.
 121 
 122  protected:                              // Monitor-Mutex metadata
 123   SplitWord _LockWord ;                  // Contention queue (cxq) colocated with Lock-byte
 124   enum LockWordBits { _LBIT=1 } ;
 125   Thread * volatile _owner;              // The owner of the lock
 126                                          // Consider sequestering _owner on its own $line
 127                                          // to aid future synchronization mechanisms.




  87 static const int MONITOR_NAME_LEN = 64;
  88 
  89 class Monitor : public CHeapObj<mtInternal> {
  90 
  91  public:
  92   // A special lock: Is a lock where you are guaranteed not to block while you are
  93   // holding it, i.e., no vm operation can happen, taking other locks, etc.
  94   // NOTE: It is critical that the rank 'special' be the lowest (earliest)
  95   // (except for "event"?) for the deadlock detection to work correctly.
  96   // The rank native is only for use in Mutex's created by JVM_RawMonitorCreate,
  97   // which being external to the VM are not subject to deadlock detection.
  98   // The rank safepoint is used only for synchronization in reaching a
  99   // safepoint and leaving a safepoint.  It is only used for the Safepoint_lock
 100   // currently.  While at a safepoint no mutexes of rank safepoint are held
 101   // by any thread.
 102   // The rank named "leaf" is probably historical (and should
 103   // be changed) -- mutexes of this rank aren't really leaf mutexes
 104   // at all.
 105   enum lock_types {
 106        event,
 107        special     = event          +   4,
 108        suspend_resume,
 109        leaf        = suspend_resume +   2,
 110        safepoint   = leaf           +  10,
 111        barrier     = safepoint      +   1,
 112        nonleaf     = barrier        +   1,
 113        max_nonleaf = nonleaf        + 900,
 114        native      = max_nonleaf    +   1
 115   };
 116 
 117   // The WaitSet and EntryList linked lists are composed of ParkEvents.
 118   // I use ParkEvent instead of threads as ParkEvents are immortal and
 119   // type-stable, meaning we can safely unpark() a possibly stale
 120   // list element in the unlock()-path.
 121 
 122  protected:                              // Monitor-Mutex metadata
 123   SplitWord _LockWord ;                  // Contention queue (cxq) colocated with Lock-byte
 124   enum LockWordBits { _LBIT=1 } ;
 125   Thread * volatile _owner;              // The owner of the lock
 126                                          // Consider sequestering _owner on its own $line
 127                                          // to aid future synchronization mechanisms.


< prev index next >