< prev index next >

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

Print this page
rev 11971 : imported patch 8157952-jon-review1


  46 //     GangWorker
  47 //     YieldingFlexibleGangWorker   (defined in another file)
  48 
  49 // Forward declarations of classes defined here
  50 
  51 class AbstractGangWorker;
  52 class Semaphore;
  53 class WorkGang;
  54 
  55 // An abstract task to be worked on by a gang.
  56 // You subclass this to supply your own work() method
  57 class AbstractGangTask VALUE_OBJ_CLASS_SPEC {
  58   const char* _name;
  59   const uint _gc_id;
  60 
  61  public:
  62   AbstractGangTask(const char* name) :
  63     _name(name),
  64     _gc_id(GCId::current_raw())
  65  {}





  66 
  67   // The abstract work method.
  68   // The argument tells you which member of the gang you are.
  69   virtual void work(uint worker_id) = 0;
  70 
  71   // Debugging accessor for the name.
  72   const char* name() const { return _name; }
  73   const uint gc_id() const { return _gc_id; }
  74 };
  75 
  76 struct WorkData {
  77   AbstractGangTask* _task;
  78   uint              _worker_id;
  79   WorkData(AbstractGangTask* task, uint worker_id) : _task(task), _worker_id(worker_id) {}
  80 };
  81 
  82 // Interface to handle the synchronization between the coordinator thread and the worker threads,
  83 // when a task is dispatched out to the worker threads.
  84 class GangTaskDispatcher : public CHeapObj<mtGC> {
  85  public:




  46 //     GangWorker
  47 //     YieldingFlexibleGangWorker   (defined in another file)
  48 
  49 // Forward declarations of classes defined here
  50 
  51 class AbstractGangWorker;
  52 class Semaphore;
  53 class WorkGang;
  54 
  55 // An abstract task to be worked on by a gang.
  56 // You subclass this to supply your own work() method
  57 class AbstractGangTask VALUE_OBJ_CLASS_SPEC {
  58   const char* _name;
  59   const uint _gc_id;
  60 
  61  public:
  62   AbstractGangTask(const char* name) :
  63     _name(name),
  64     _gc_id(GCId::current_raw())
  65   {}
  66 
  67   AbstractGangTask(const char* name, const uint gc_id) : 
  68     _name(name),
  69     _gc_id(gc_id)
  70   {}
  71 
  72   // The abstract work method.
  73   // The argument tells you which member of the gang you are.
  74   virtual void work(uint worker_id) = 0;
  75 
  76   // Debugging accessor for the name.
  77   const char* name() const { return _name; }
  78   const uint gc_id() const { return _gc_id; }
  79 };
  80 
  81 struct WorkData {
  82   AbstractGangTask* _task;
  83   uint              _worker_id;
  84   WorkData(AbstractGangTask* task, uint worker_id) : _task(task), _worker_id(worker_id) {}
  85 };
  86 
  87 // Interface to handle the synchronization between the coordinator thread and the worker threads,
  88 // when a task is dispatched out to the worker threads.
  89 class GangTaskDispatcher : public CHeapObj<mtGC> {
  90  public:


< prev index next >