CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::WaitingTaskHolder Class Reference

#include <WaitingTaskHolder.h>

Public Member Functions

void doneWaiting (std::exception_ptr iExcept)
 
WaitingTaskHolderoperator= (const WaitingTaskHolder &iRHS)
 
void presetTaskAsFailed (std::exception_ptr iExcept)
 
bool taskHasFailed () const
 
 WaitingTaskHolder ()
 
 WaitingTaskHolder (edm::WaitingTask *iTask)
 
 WaitingTaskHolder (const WaitingTaskHolder &iHolder)
 
 WaitingTaskHolder (WaitingTaskHolder &&iOther)
 
 ~WaitingTaskHolder ()
 

Private Attributes

WaitingTaskm_task
 

Detailed Description

Definition at line 30 of file WaitingTaskHolder.h.

Constructor & Destructor Documentation

edm::WaitingTaskHolder::WaitingTaskHolder ( )
inline

Definition at line 32 of file WaitingTaskHolder.h.

32 : m_task(nullptr) {}
edm::WaitingTaskHolder::WaitingTaskHolder ( edm::WaitingTask iTask)
inlineexplicit

Definition at line 34 of file WaitingTaskHolder.h.

References m_task.

34 : m_task(iTask) { m_task->increment_ref_count(); }
edm::WaitingTaskHolder::~WaitingTaskHolder ( )
inline

Definition at line 35 of file WaitingTaskHolder.h.

References doneWaiting(), and m_task.

35  {
36  if (m_task) {
37  doneWaiting(std::exception_ptr{});
38  }
39  }
void doneWaiting(std::exception_ptr iExcept)
edm::WaitingTaskHolder::WaitingTaskHolder ( const WaitingTaskHolder iHolder)
inline

Definition at line 41 of file WaitingTaskHolder.h.

References m_task.

41 : m_task(iHolder.m_task) { m_task->increment_ref_count(); }
edm::WaitingTaskHolder::WaitingTaskHolder ( WaitingTaskHolder &&  iOther)
inline

Definition at line 43 of file WaitingTaskHolder.h.

43 : m_task(iOther.m_task) { iOther.m_task = nullptr; }

Member Function Documentation

void edm::WaitingTaskHolder::doneWaiting ( std::exception_ptr  iExcept)
inline

Definition at line 69 of file WaitingTaskHolder.h.

References edm::WaitingTask::dependentTaskFailed(), m_task, and TrackValidation_cff::task.

Referenced by edm::beginGlobalTransitionAsync(), edm::EventProcessor::beginLumiAsync(), edm::beginStreamTransitionAsync(), edm::endGlobalTransitionAsync(), edm::endStreamTransitionAsync(), edm::Worker::HandleExternalWorkExceptionTask::execute(), edm::StreamSchedule::finishedPaths(), edm::EventProcessor::handleEndLumiExceptions(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::SubProcess::processAsync(), edm::EventProcessor::processEventAsyncImpl(), edm::StreamSchedule::processOneEventAsync(), edm::GlobalSchedule::processOneGlobalAsync(), edm::StreamSchedule::processOneStreamAsync(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), edm::SubProcess::writeLumiAsync(), edm::EventProcessor::writeLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeRunAsync(), edm::SubProcess::writeRunAsync(), edm::EventProcessor::writeRunAsync(), and ~WaitingTaskHolder().

69  {
70  if (iExcept) {
71  m_task->dependentTaskFailed(iExcept);
72  }
73  //spawn can run the task before we finish
74  // doneWaiting and some other thread might
75  // try to reuse this object. Resetting
76  // before spawn avoids problems
77  auto task = m_task;
78  m_task = nullptr;
79  if (0 == task->decrement_ref_count()) {
80  tbb::task::spawn(*task);
81  }
82  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59
WaitingTaskHolder& edm::WaitingTaskHolder::operator= ( const WaitingTaskHolder iRHS)
inline

Definition at line 45 of file WaitingTaskHolder.h.

References m_task, std::swap(), and tmp.

45  {
46  WaitingTaskHolder tmp(iRHS);
47  std::swap(m_task, tmp.m_task);
48  return *this;
49  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void edm::WaitingTaskHolder::presetTaskAsFailed ( std::exception_ptr  iExcept)
inline

Use in the case where you need to inform the parent task of a failure before some other child task which may be run later reports a different, but related failure. You must later call doneWaiting in the same thread passing the same exceptoin.

Definition at line 63 of file WaitingTaskHolder.h.

References edm::WaitingTask::dependentTaskFailed(), and m_task.

63  {
64  if (iExcept) {
65  m_task->dependentTaskFailed(iExcept);
66  }
67  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59
bool edm::WaitingTaskHolder::taskHasFailed ( ) const
inline

Definition at line 52 of file WaitingTaskHolder.h.

References edm::WaitingTask::exceptionPtr(), and m_task.

Referenced by edm::EventProcessor::beginLumiAsync().

52 { return m_task->exceptionPtr() != nullptr; }
std::exception_ptr const * exceptionPtr() const
Returns exception thrown by dependent task.
Definition: WaitingTask.h:51

Member Data Documentation

WaitingTask* edm::WaitingTaskHolder::m_task
private