ThreadPoolInterface.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H
11 #define EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H
12 
13 namespace Eigen {
14 
15 // This defines an interface that ThreadPoolDevice can take to use
16 // custom thread pools underneath.
18  public:
19  // Submits a closure to be run by a thread in the pool.
20  virtual void Schedule(std::function<void()> fn) = 0;
21 
22  // Submits a closure to be run by threads in the range [start, end) in the
23  // pool.
24  virtual void ScheduleWithHint(std::function<void()> fn, int /*start*/,
25  int /*end*/) {
26  // Just defer to Schedule in case sub-classes aren't interested in
27  // overriding this functionality.
28  Schedule(fn);
29  }
30 
31  // If implemented, stop processing the closures that have been enqueued.
32  // Currently running closures may still be processed.
33  // If not implemented, does nothing.
34  virtual void Cancel() {}
35 
36  // Returns the number of threads in the pool.
37  virtual int NumThreads() const = 0;
38 
39  // Returns a logical thread index between 0 and NumThreads() - 1 if called
40  // from one of the threads in the pool. Returns -1 otherwise.
41  virtual int CurrentThreadId() const = 0;
42 
43  virtual ~ThreadPoolInterface() {}
44 };
45 
46 } // namespace Eigen
47 
48 #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
fn
static double fn[10]
Definition: fresnl.c:103
Eigen::ThreadPoolInterface::ScheduleWithHint
virtual void ScheduleWithHint(std::function< void()> fn, int, int)
Definition: ThreadPoolInterface.h:24
Eigen::ThreadPoolInterface::NumThreads
virtual int NumThreads() const =0
Eigen::ThreadPoolInterface::~ThreadPoolInterface
virtual ~ThreadPoolInterface()
Definition: ThreadPoolInterface.h:43
Eigen::ThreadPoolInterface
Definition: ThreadPoolInterface.h:17
Eigen::ThreadPoolInterface::Cancel
virtual void Cancel()
Definition: ThreadPoolInterface.h:34
Eigen::ThreadPoolInterface::Schedule
virtual void Schedule(std::function< void()> fn)=0
Eigen::ThreadPoolInterface::CurrentThreadId
virtual int CurrentThreadId() const =0


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:08:56