< prev index next >

src/share/vm/runtime/vmThread.hpp

Print this page




  87 //
  88 // A single VMThread (the primordial thread) spawns all other threads
  89 // and is itself used by other threads to offload heavy vm operations
  90 // like scavenge, garbage_collect etc.
  91 //
  92 
  93 class VMThread: public NamedThread {
  94  private:
  95   static ThreadPriority _current_priority;
  96 
  97   static bool _should_terminate;
  98   static bool _terminated;
  99   static Monitor * _terminate_lock;
 100   static PerfCounter* _perf_accumulated_vm_operation_time;
 101 
 102   void evaluate_operation(VM_Operation* op);
 103  public:
 104   // Constructor
 105   VMThread();
 106 






 107   // Tester
 108   bool is_VM_thread() const                      { return true; }
 109   bool is_GC_thread() const                      { return true; }
 110 
 111   // The ever running loop for the VMThread
 112   void loop();
 113 
 114   // Called to stop the VM thread
 115   static void wait_for_vm_thread_exit();
 116   static bool should_terminate()                  { return _should_terminate; }
 117   static bool is_terminated()                     { return _terminated == true; }
 118 
 119   // Execution of vm operation
 120   static void execute(VM_Operation* op);
 121 
 122   // Returns the current vm operation if any.
 123   static VM_Operation* vm_operation()             { return _cur_vm_operation;   }
 124 
 125   // Returns the single instance of VMThread.
 126   static VMThread* vm_thread()                    { return _vm_thread; }




  87 //
  88 // A single VMThread (the primordial thread) spawns all other threads
  89 // and is itself used by other threads to offload heavy vm operations
  90 // like scavenge, garbage_collect etc.
  91 //
  92 
  93 class VMThread: public NamedThread {
  94  private:
  95   static ThreadPriority _current_priority;
  96 
  97   static bool _should_terminate;
  98   static bool _terminated;
  99   static Monitor * _terminate_lock;
 100   static PerfCounter* _perf_accumulated_vm_operation_time;
 101 
 102   void evaluate_operation(VM_Operation* op);
 103  public:
 104   // Constructor
 105   VMThread();
 106 
 107   // No destruction allowed
 108   ~VMThread() {
 109     guarantee(false, "VMThread deletion must fix the race with VM termination");
 110   }
 111 
 112 
 113   // Tester
 114   bool is_VM_thread() const                      { return true; }
 115   bool is_GC_thread() const                      { return true; }
 116 
 117   // The ever running loop for the VMThread
 118   void loop();
 119 
 120   // Called to stop the VM thread
 121   static void wait_for_vm_thread_exit();
 122   static bool should_terminate()                  { return _should_terminate; }
 123   static bool is_terminated()                     { return _terminated == true; }
 124 
 125   // Execution of vm operation
 126   static void execute(VM_Operation* op);
 127 
 128   // Returns the current vm operation if any.
 129   static VM_Operation* vm_operation()             { return _cur_vm_operation;   }
 130 
 131   // Returns the single instance of VMThread.
 132   static VMThread* vm_thread()                    { return _vm_thread; }


< prev index next >