< prev index next >

src/hotspot/share/runtime/osThread.hpp

Print this page




  36 
  37 // The thread states represented by the ThreadState values are platform-specific
  38 // and are likely to be only approximate, because most OSes don't give you access
  39 // to precise thread state information.
  40 
  41 // Note: the ThreadState is legacy code and is not correctly implemented.
  42 // Uses of ThreadState need to be replaced by the state in the JavaThread.
  43 
  44 enum ThreadState {
  45   ALLOCATED,                    // Memory has been allocated but not initialized
  46   INITIALIZED,                  // The thread has been initialized but yet started
  47   RUNNABLE,                     // Has been started and is runnable, but not necessarily running
  48   MONITOR_WAIT,                 // Waiting on a contended monitor lock
  49   CONDVAR_WAIT,                 // Waiting on a condition variable
  50   OBJECT_WAIT,                  // Waiting on an Object.wait() call
  51   BREAKPOINTED,                 // Suspended at breakpoint
  52   SLEEPING,                     // Thread.sleep()
  53   ZOMBIE                        // All done, but not reclaimed yet
  54 };
  55 
  56 // I'd make OSThread a ValueObj embedded in Thread to avoid an indirection, but
  57 // the assembler test in java.cpp expects that it can install the OSThread of
  58 // the main thread into its own Thread at will.
  59 
  60 
  61 class OSThread: public CHeapObj<mtThread> {
  62   friend class VMStructs;
  63   friend class JVMCIVMStructs;
  64  private:
  65   OSThreadStartFunc _start_proc;  // Thread start routine
  66   void* _start_parm;              // Thread start routine parameter
  67   volatile ThreadState _state;    // Thread state *hint*
  68   volatile jint _interrupted;     // Thread.isInterrupted state
  69 
  70   // Note:  _interrupted must be jint, so that Java intrinsics can access it.
  71   // The value stored there must be either 0 or 1.  It must be possible
  72   // for Java to emulate Thread.currentThread().isInterrupted() by performing
  73   // the double indirection Thread::current()->_osthread->_interrupted.
  74 
  75   // Methods
  76  public:
  77   void set_state(ThreadState state)                { _state = state; }
  78   ThreadState get_state()                          { return _state; }
  79 
  80   OSThread(OSThreadStartFunc start_proc, void* start_parm);




  36 
  37 // The thread states represented by the ThreadState values are platform-specific
  38 // and are likely to be only approximate, because most OSes don't give you access
  39 // to precise thread state information.
  40 
  41 // Note: the ThreadState is legacy code and is not correctly implemented.
  42 // Uses of ThreadState need to be replaced by the state in the JavaThread.
  43 
  44 enum ThreadState {
  45   ALLOCATED,                    // Memory has been allocated but not initialized
  46   INITIALIZED,                  // The thread has been initialized but yet started
  47   RUNNABLE,                     // Has been started and is runnable, but not necessarily running
  48   MONITOR_WAIT,                 // Waiting on a contended monitor lock
  49   CONDVAR_WAIT,                 // Waiting on a condition variable
  50   OBJECT_WAIT,                  // Waiting on an Object.wait() call
  51   BREAKPOINTED,                 // Suspended at breakpoint
  52   SLEEPING,                     // Thread.sleep()
  53   ZOMBIE                        // All done, but not reclaimed yet
  54 };
  55 





  56 class OSThread: public CHeapObj<mtThread> {
  57   friend class VMStructs;
  58   friend class JVMCIVMStructs;
  59  private:
  60   OSThreadStartFunc _start_proc;  // Thread start routine
  61   void* _start_parm;              // Thread start routine parameter
  62   volatile ThreadState _state;    // Thread state *hint*
  63   volatile jint _interrupted;     // Thread.isInterrupted state
  64 
  65   // Note:  _interrupted must be jint, so that Java intrinsics can access it.
  66   // The value stored there must be either 0 or 1.  It must be possible
  67   // for Java to emulate Thread.currentThread().isInterrupted() by performing
  68   // the double indirection Thread::current()->_osthread->_interrupted.
  69 
  70   // Methods
  71  public:
  72   void set_state(ThreadState state)                { _state = state; }
  73   ThreadState get_state()                          { return _state; }
  74 
  75   OSThread(OSThreadStartFunc start_proc, void* start_parm);


< prev index next >