8212074: Add method to peek the remaining tasks in task queues
Add methods for implementing new task termination protocol Reviewed-by: tschatzl, shade, rkennke
This commit is contained in:
parent
4fe2edae59
commit
a0ce3d3f18
@ -370,6 +370,8 @@ class TaskQueueSetSuper {
|
|||||||
public:
|
public:
|
||||||
// Returns "true" if some TaskQueue in the set contains a task.
|
// Returns "true" if some TaskQueue in the set contains a task.
|
||||||
virtual bool peek() = 0;
|
virtual bool peek() = 0;
|
||||||
|
// Tasks in queue
|
||||||
|
virtual uint tasks() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
|
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
|
||||||
@ -399,6 +401,7 @@ public:
|
|||||||
bool steal(uint queue_num, E& t);
|
bool steal(uint queue_num, E& t);
|
||||||
|
|
||||||
bool peek();
|
bool peek();
|
||||||
|
uint tasks() const;
|
||||||
|
|
||||||
uint size() const { return _n; }
|
uint size() const { return _n; }
|
||||||
};
|
};
|
||||||
@ -424,6 +427,15 @@ bool GenericTaskQueueSet<T, F>::peek() {
|
|||||||
return false;
|
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.
|
// When to terminate from the termination protocol.
|
||||||
class TerminatorTerminator: public CHeapObj<mtInternal> {
|
class TerminatorTerminator: public CHeapObj<mtInternal> {
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user