CMS 3D CMS Logo

ThreadsController.h
Go to the documentation of this file.
1 #ifndef FWCore_Concurrency_ThreadsController_h
2 #define FWCore_Concurrency_ThreadsController_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Concurrency
6 // Class : ThreadsController
7 //
16 //
17 // Original Author: FWCore
18 // Created: Fri, 18 Nov 2016 20:30:42 GMT
19 //
20 
21 // system include files
22 #include "tbb/global_control.h"
23 #include "tbb/task_arena.h"
24 #include <memory>
25 
26 // user include files
27 
28 // forward declarations
29 
30 namespace edm {
32  public:
33  ThreadsController() = delete;
34  explicit ThreadsController(unsigned int iNThreads)
35  : m_nThreads{tbb::global_control::max_allowed_parallelism, iNThreads}, m_stackSize{} {}
36  ThreadsController(unsigned int iNThreads, size_t iStackSize)
37  : m_nThreads{tbb::global_control::max_allowed_parallelism, iNThreads}, m_stackSize{makeStackSize(iStackSize)} {}
38 
39  // ---------- member functions ---------------------------
40  void setStackSize(size_t iStackSize) { m_stackSize = makeStackSize(iStackSize); }
41 
42  private:
43  static std::unique_ptr<tbb::global_control> makeStackSize(size_t iStackSize);
44 
45  // ---------- member data --------------------------------
46  tbb::global_control m_nThreads;
47  std::unique_ptr<tbb::global_control> m_stackSize;
48  };
49 } // namespace edm
50 
51 #endif
edm::ThreadsController::setStackSize
void setStackSize(size_t iStackSize)
Definition: ThreadsController.h:40
edm::ThreadsController
Definition: ThreadsController.h:31
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ThreadsController::ThreadsController
ThreadsController()=delete
edm::ThreadsController::ThreadsController
ThreadsController(unsigned int iNThreads)
Definition: ThreadsController.h:34
edm::ThreadsController::makeStackSize
static std::unique_ptr< tbb::global_control > makeStackSize(size_t iStackSize)
Definition: ThreadsController.cc:19
edm::ThreadsController::m_nThreads
tbb::global_control m_nThreads
Definition: ThreadsController.h:46
edm::ThreadsController::m_stackSize
std::unique_ptr< tbb::global_control > m_stackSize
Definition: ThreadsController.h:47
edm::ThreadsController::ThreadsController
ThreadsController(unsigned int iNThreads, size_t iStackSize)
Definition: ThreadsController.h:36