< prev index next >

src/hotspot/share/gc/shared/taskqueue.hpp

Print this page

        

@@ -445,12 +445,12 @@
 // A class to aid in the termination of a set of parallel tasks using
 // TaskQueueSet's for work stealing.
 
 #undef TRACESPINNING
 
-class ParallelTaskTerminator: public StackObj {
-private:
+class ParallelTaskTerminator: public CHeapObj<mtGC> {
+protected:
   uint _n_threads;
   TaskQueueSetSuper* _queue_set;
   volatile uint _offered_termination;
 
 #ifdef TRACESPINNING

@@ -479,11 +479,11 @@
   }
 
   // As above, but it also terminates if the should_exit_termination()
   // method of the terminator parameter returns true. If terminator is
   // NULL, then it is ignored.
-  bool offer_termination(TerminatorTerminator* terminator);
+  virtual bool offer_termination(TerminatorTerminator* terminator);
 
   // Reset the terminator, so that it may be reused again.
   // The caller is responsible for ensuring that this is done
   // in an MT-safe manner, once the previous round of use of
   // the terminator is finished.

@@ -498,10 +498,30 @@
   static uint total_peeks() { return _total_peeks; }
   static void print_termination_counts();
 #endif
 };
 
+class TaskTerminator : public StackObj {
+private:
+  ParallelTaskTerminator*  _terminator;
+
+  // Disable following copy constructors and assignment operator
+  TaskTerminator(TaskTerminator& o) { }
+  TaskTerminator(const TaskTerminator& o) { }
+  TaskTerminator& operator=(TaskTerminator& o) { return *this; }
+public:
+  TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set);
+  ~TaskTerminator();
+
+  // Move assignment
+  TaskTerminator& operator=(const TaskTerminator& o);
+
+  ParallelTaskTerminator* terminator() const {
+    return _terminator;
+  }
+};
+
 typedef GenericTaskQueue<oop, mtGC>             OopTaskQueue;
 typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;
 
 #ifdef _MSC_VER
 #pragma warning(push)
< prev index next >