CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WaitingTaskHolder.h
Go to the documentation of this file.
1 #ifndef FWCore_Concurrency_WaitingTaskHolder_h
2 #define FWCore_Concurrency_WaitingTaskHolder_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Concurrency
6 // Class : WaitingTaskHolder
7 //
16 //
17 // Original Author: FWCore
18 // Created: Fri, 18 Nov 2016 20:30:42 GMT
19 //
20 
21 // system include files
22 #include <cassert>
23 
24 // user include files
26 
27 // forward declarations
28 
29 namespace edm {
31  {
32 
33  public:
35  m_task(nullptr) {}
36 
38  m_task(iTask)
39  {m_task->increment_ref_count();}
41  if(m_task) {
42  doneWaiting(std::exception_ptr{});
43  }
44  }
45 
47  m_task(iHolder.m_task) {
48  m_task->increment_ref_count();
49  }
50 
52  m_task(iOther.m_task) {
53  iOther.m_task = nullptr;
54  }
55 
57  WaitingTaskHolder tmp(iRHS);
58  std::swap(m_task, tmp.m_task);
59  return *this;
60  }
61 
62  // ---------- const member functions ---------------------
63 
64  // ---------- static member functions --------------------
65 
66  // ---------- member functions ---------------------------
67  void doneWaiting(std::exception_ptr iExcept) {
68  if(iExcept) {
69  m_task->dependentTaskFailed(iExcept);
70  }
71  if(0==m_task->decrement_ref_count()){
72  tbb::task::spawn(*m_task);
73  }
74  m_task = nullptr;
75  }
76 
77  private:
78 
79  // ---------- member data --------------------------------
81  };
82 }
83 
84 #endif
#define nullptr
WaitingTaskHolder & operator=(const WaitingTaskHolder &iRHS)
WaitingTaskHolder(WaitingTaskHolder &&iOther)
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:62
void doneWaiting(std::exception_ptr iExcept)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
WaitingTaskHolder(const WaitingTaskHolder &iHolder)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
WaitingTaskHolder(edm::WaitingTask *iTask)