< prev index next >

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

Print this page

        

@@ -368,10 +368,12 @@
 
 class TaskQueueSetSuper {
 public:
   // Returns "true" if some TaskQueue in the set contains a task.
   virtual bool peek() = 0;
+  // Tasks in queue
+  virtual uint tasks() const = 0;
 };
 
 template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
 };
 

@@ -397,10 +399,11 @@
   // Try to steal a task from some other queue than queue_num. It may perform several attempts at doing so.
   // Returns if stealing succeeds, and sets "t" to the stolen task.
   bool steal(uint queue_num, E& t);
 
   bool peek();
+  uint tasks() const;
 
   uint size() const { return _n; }
 };
 
 template<class T, MEMFLAGS F> void

@@ -422,10 +425,19 @@
       return true;
   }
   return false;
 }
 
+template<class T, MEMFLAGS F>
+uint GenericTaskQueueSet<T, F>::tasks() const {
+  uint n = 0;
+  for (uint j = 0; j < _n; j++) {
+    n += _queues[j]->size();
+  }
+  return n; 
+}
+
 // When to terminate from the termination protocol.
 class TerminatorTerminator: public CHeapObj<mtInternal> {
 public:
   virtual bool should_exit_termination() = 0;
 };

@@ -434,11 +446,11 @@
 // TaskQueueSet's for work stealing.
 
 #undef TRACESPINNING
 
 class ParallelTaskTerminator: public StackObj {
-private:
+protected:
   uint _n_threads;
   TaskQueueSetSuper* _queue_set;
   volatile uint _offered_termination;
 
 #ifdef TRACESPINNING
< prev index next >