From 28ee8f42b269c5da474c550dc8d35fe41c085429 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 8 Dec 2016 14:07:56 -0800 Subject: Added a Flush method to the RunQueue --- unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/ThreadPool') diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h b/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h index 05ed76cbe..49d0cdc36 100644 --- a/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h +++ b/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h @@ -177,6 +177,13 @@ class RunQueue { // Can be called by any thread at any time. bool Empty() const { return Size() == 0; } + // Delete all the elements from the queue. + void Flush() { + while (!Empty()) { + PopFront(); + } + } + private: static const unsigned kMask = kSize - 1; static const unsigned kMask2 = (kSize << 1) - 1; -- cgit v1.2.3