< prev index next >

src/share/vm/gc/shared/workgroup.hpp

Print this page




 191   // Debugging.
 192   const char* name() const { return _name; }
 193 
 194   // Printing
 195   void print_worker_threads_on(outputStream *st) const;
 196   void print_worker_threads() const {
 197     print_worker_threads_on(tty);
 198   }
 199 
 200  protected:
 201   virtual AbstractGangWorker* allocate_worker(uint which) = 0;
 202 };
 203 
 204 // An class representing a gang of workers.
 205 class WorkGang: public AbstractWorkGang {
 206   // To get access to the GangTaskDispatcher instance.
 207   friend class GangWorker;
 208 
 209 
 210   GangTaskDispatcher* const _dispatcher;


 211   GangTaskDispatcher* dispatcher() const {
 212     return _dispatcher;
 213   }
 214 
 215 protected:
 216   // Never deleted.
 217   ~WorkGang() {
 218     ShouldNotReachHere();
 219   }
 220 
 221 
 222 public:
 223   WorkGang(const char* name,
 224            uint workers,
 225            bool are_GC_task_threads,
 226            bool are_ConcurrentGC_threads);






 227 
 228   // Run a task using the current active number of workers, returns when the task is done.
 229   virtual void run_task(AbstractGangTask* task);
 230   // Run a task with the given number of workers, returns
 231   // when the task is done. The number of workers must be at most the number of
 232   // active workers.  Additional workers may be created if an insufficient
 233   // number currently exists.
 234   void run_task(AbstractGangTask* task, uint num_workers);
 235 
 236 protected:
 237   virtual AbstractGangWorker* allocate_worker(uint which);
 238 };
 239 
 240 // Several instances of this class run in parallel as workers for a gang.
 241 class AbstractGangWorker: public WorkerThread {
 242 public:
 243   AbstractGangWorker(AbstractWorkGang* gang, uint id);
 244 
 245   // The only real method: run a task for the gang.
 246   virtual void run();




 191   // Debugging.
 192   const char* name() const { return _name; }
 193 
 194   // Printing
 195   void print_worker_threads_on(outputStream *st) const;
 196   void print_worker_threads() const {
 197     print_worker_threads_on(tty);
 198   }
 199 
 200  protected:
 201   virtual AbstractGangWorker* allocate_worker(uint which) = 0;
 202 };
 203 
 204 // An class representing a gang of workers.
 205 class WorkGang: public AbstractWorkGang {
 206   // To get access to the GangTaskDispatcher instance.
 207   friend class GangWorker;
 208 
 209 
 210   GangTaskDispatcher* const _dispatcher;
 211 
 212 protected:
 213   GangTaskDispatcher* dispatcher() const {
 214     return _dispatcher;
 215   }
 216 

 217   // Never deleted.
 218   ~WorkGang() {
 219     ShouldNotReachHere();
 220   }
 221 
 222 
 223 public:
 224   WorkGang(const char* name,
 225            uint workers,
 226            bool are_GC_task_threads,
 227            bool are_ConcurrentGC_threads);
 228 
 229   WorkGang(const char* name,
 230            uint workers,
 231            bool are_GC_task_threads,
 232            bool are_ConcurrentGC_threads,
 233            GangTaskDispatcher* dispatcher);
 234 
 235   // Run a task using the current active number of workers, returns when the task is done.
 236   virtual void run_task(AbstractGangTask* task);
 237   // Run a task with the given number of workers, returns
 238   // when the task is done. The number of workers must be at most the number of
 239   // active workers.  Additional workers may be created if an insufficient
 240   // number currently exists.
 241   void run_task(AbstractGangTask* task, uint num_workers);
 242 
 243 protected:
 244   virtual AbstractGangWorker* allocate_worker(uint which);
 245 };
 246 
 247 // Several instances of this class run in parallel as workers for a gang.
 248 class AbstractGangWorker: public WorkerThread {
 249 public:
 250   AbstractGangWorker(AbstractWorkGang* gang, uint id);
 251 
 252   // The only real method: run a task for the gang.
 253   virtual void run();


< prev index next >