aboutsummaryrefslogtreecommitdiff
path: root/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2022-02-25 17:02:53 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-25 17:02:53 +0000
commitedb0ad5bb04b48aab7dd0978f0475edd3550de7c (patch)
treefb979fb4cf4f8052c8cc66b1ec9516d91fcd859b /unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h
parent8fd413e275f78a4c240f1442ce5cf77c73a20a55 (diff)
parentbc0f5df265caa21a2120c22453655a7fcc941991 (diff)
downloadeigen-aml_uwb_331410010.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/eigen/+/1999079 Change-Id: Ife39d10c8b23d3eeb174cd52f462f9d20527ad03
Diffstat (limited to 'unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h')
-rw-r--r--unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h b/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h
index a65ee97c9..25030dc0b 100644
--- a/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h
+++ b/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h
@@ -16,8 +16,23 @@ namespace Eigen {
// custom thread pools underneath.
class ThreadPoolInterface {
public:
+ // Submits a closure to be run by a thread in the pool.
virtual void Schedule(std::function<void()> fn) = 0;
+ // Submits a closure to be run by threads in the range [start, end) in the
+ // pool.
+ virtual void ScheduleWithHint(std::function<void()> fn, int /*start*/,
+ int /*end*/) {
+ // Just defer to Schedule in case sub-classes aren't interested in
+ // overriding this functionality.
+ Schedule(fn);
+ }
+
+ // If implemented, stop processing the closures that have been enqueued.
+ // Currently running closures may still be processed.
+ // If not implemented, does nothing.
+ virtual void Cancel() {}
+
// Returns the number of threads in the pool.
virtual int NumThreads() const = 0;