CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::WaitingTaskHolder Class Reference

#include <WaitingTaskHolder.h>

Public Member Functions

void doneWaiting (std::exception_ptr iExcept)
 
tbb::task_group * group () const noexcept
 
bool hasTask () const noexcept
 
WaitingTaskHolderoperator= (const WaitingTaskHolder &iRHS)
 
WaitingTaskHolderoperator= (WaitingTaskHolder &&iRHS)
 
void presetTaskAsFailed (std::exception_ptr iExcept)
 
bool taskHasFailed () const noexcept
 
 WaitingTaskHolder ()
 
 WaitingTaskHolder (tbb::task_group &iGroup, edm::WaitingTask *iTask)
 
 WaitingTaskHolder (const WaitingTaskHolder &iHolder)
 
 WaitingTaskHolder (WaitingTaskHolder &&iOther)
 
 ~WaitingTaskHolder ()
 

Private Member Functions

WaitingTaskrelease_no_decrement () noexcept
 

Private Attributes

tbb::task_group * m_group
 
WaitingTaskm_task
 

Friends

class WaitingTaskList
 
class WaitingTaskWithArenaHolder
 

Detailed Description

Definition at line 32 of file WaitingTaskHolder.h.

Constructor & Destructor Documentation

edm::WaitingTaskHolder::WaitingTaskHolder ( )
inline

Definition at line 37 of file WaitingTaskHolder.h.

37 : m_task(nullptr), m_group(nullptr) {}
tbb::task_group * m_group
edm::WaitingTaskHolder::WaitingTaskHolder ( tbb::task_group &  iGroup,
edm::WaitingTask iTask 
)
inlineexplicit

Definition at line 39 of file WaitingTaskHolder.h.

References edm::TaskBase::increment_ref_count(), and m_task.

39  : m_task(iTask), m_group(&iGroup) {
41  }
tbb::task_group * m_group
void increment_ref_count()
Definition: TaskBase.h:41
edm::WaitingTaskHolder::~WaitingTaskHolder ( )
inline

Definition at line 42 of file WaitingTaskHolder.h.

References doneWaiting(), and m_task.

42  {
43  if (m_task) {
44  doneWaiting(std::exception_ptr{});
45  }
46  }
void doneWaiting(std::exception_ptr iExcept)
edm::WaitingTaskHolder::WaitingTaskHolder ( const WaitingTaskHolder iHolder)
inline

Definition at line 48 of file WaitingTaskHolder.h.

References edm::TaskBase::increment_ref_count(), and m_task.

48  : m_task(iHolder.m_task), m_group(iHolder.m_group) {
50  }
tbb::task_group * m_group
void increment_ref_count()
Definition: TaskBase.h:41
edm::WaitingTaskHolder::WaitingTaskHolder ( WaitingTaskHolder &&  iOther)
inline

Definition at line 52 of file WaitingTaskHolder.h.

52  : m_task(iOther.m_task), m_group(iOther.m_group) {
53  iOther.m_task = nullptr;
54  }
tbb::task_group * m_group

Member Function Documentation

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

Definition at line 93 of file WaitingTaskHolder.h.

References edm::WaitingTask::dependentTaskFailed(), m_group, m_task, and alignCSCRings::s.

Referenced by edm::WaitingTaskList::add(), edm::EventProcessor::beginLumiAsync(), edm::Worker::HandleExternalWorkExceptionTask::execute(), edm::StreamSchedule::finishedPaths(), edm::EventProcessor::handleEndLumiExceptions(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::StreamSchedule::processOneEventAsync(), edm::GlobalSchedule::processOneGlobalAsync(), edm::StreamSchedule::processOneStreamAsync(), edm::eventsetup::synchronousEventSetupForInstance(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeProcessBlockAsync(), edm::OutputModuleCommunicatorT< T >::writeRunAsync(), and ~WaitingTaskHolder().

93  {
94  if (iExcept) {
95  m_task->dependentTaskFailed(iExcept);
96  }
97  //task_group::run can run the task before we finish
98  // doneWaiting and some other thread might
99  // try to reuse this object. Resetting
100  // before spawn avoids problems
101  auto task = m_task;
102  m_task = nullptr;
103  if (0 == task->decrement_ref_count()) {
104  m_group->run([task]() {
105  TaskSentry s{task};
106  task->execute();
107  });
108  }
109  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59
tbb::task_group * m_group
tbb::task_group* edm::WaitingTaskHolder::group ( ) const
inlinenoexcept

since tbb::task_group is thread safe, we can return it non-const from here since the object is not really part of the state of the holder

Definition at line 77 of file WaitingTaskHolder.h.

References m_group.

Referenced by edm::WaitingTaskList::add(), edm::EventProcessor::continueLumiAsync(), evf::GlobalEvFOutputEventWriter::doOutputEventAsync(), edm::Worker::doWorkAsync(), edm::Worker::doWorkNoPrefetchingAsync(), edm::EDLooperBase::esPrefetchAsync(), edm::Worker::esPrefetchAsync(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::waiting_task::detail::WaitingTaskChain< U >::lastTask(), edm::waiting_task::detail::WaitingTaskChain< U, T...>::lastTask(), edm::waiting_task::detail::WaitingTaskChain< Conditional< U >, T...>::lastTask(), edm::eventsetup::Callback< T, TReturn, TRecord, TDecorator >::prefetchAsync(), edm::DelayedReaderInputProductResolver::prefetchAsync_(), edm::PuttableProductResolver::prefetchAsync_(), edm::UnscheduledProductResolver::prefetchAsync_(), edm::SwitchProducerProductResolver::prefetchAsync_(), edm::SwitchAliasProductResolver::prefetchAsync_(), edm::NoProcessProductResolver::prefetchAsync_(), edm::eventsetup::ESSourceDataProxyBase::prefetchAsyncImpl(), edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetchAsyncImpl(), edm::EventProcessor::processEventAsync(), edm::StreamSchedule::processOneEventAsync(), edm::GlobalSchedule::processOneGlobalAsync(), edm::Path::processOneOccurrenceAsync(), edm::StreamSchedule::processOneStreamAsync(), edm::waiting_task::detail::WaitingTaskChain< U, T...>::runLast(), edm::waiting_task::detail::WaitingTaskChain< Conditional< U >, T...>::runLast(), edm::eventsetup::EventSetupRecordIOVQueue::startNewIOVAsync(), edm::EventProcessor::streamEndLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeProcessBlockAsync(), and edm::OutputModuleCommunicatorT< T >::writeRunAsync().

77 { return m_group; }
tbb::task_group * m_group
bool edm::WaitingTaskHolder::hasTask ( ) const
inlinenoexcept

Definition at line 73 of file WaitingTaskHolder.h.

References m_task.

Referenced by edm::eventsetup::EventSetupRecordIOVQueue::endIOVAsync().

73 { return m_task != nullptr; }
WaitingTaskHolder& edm::WaitingTaskHolder::operator= ( const WaitingTaskHolder iRHS)
inline

Definition at line 56 of file WaitingTaskHolder.h.

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

56  {
57  WaitingTaskHolder tmp(iRHS);
58  std::swap(m_task, tmp.m_task);
59  std::swap(m_group, tmp.m_group);
60  return *this;
61  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tbb::task_group * m_group
tmp
align.sh
Definition: createJobs.py:716
WaitingTaskHolder& edm::WaitingTaskHolder::operator= ( WaitingTaskHolder &&  iRHS)
inline

Definition at line 63 of file WaitingTaskHolder.h.

References m_group, m_task, eostools::move(), std::swap(), and createJobs::tmp.

63  {
65  std::swap(m_task, tmp.m_task);
66  std::swap(m_group, tmp.m_group);
67  return *this;
68  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
def move
Definition: eostools.py:511
tbb::task_group * m_group
tmp
align.sh
Definition: createJobs.py:716
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 87 of file WaitingTaskHolder.h.

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

87  {
88  if (iExcept) {
89  m_task->dependentTaskFailed(iExcept);
90  }
91  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59
WaitingTask* edm::WaitingTaskHolder::release_no_decrement ( )
inlineprivatenoexcept

Definition at line 112 of file WaitingTaskHolder.h.

References m_task, and submitPVValidationJobs::t.

Referenced by edm::WaitingTaskList::add().

112  {
113  auto t = m_task;
114  m_task = nullptr;
115  return t;
116  }
bool edm::WaitingTaskHolder::taskHasFailed ( ) const
inlinenoexcept

Definition at line 71 of file WaitingTaskHolder.h.

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

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

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

Friends And Related Function Documentation

friend class WaitingTaskList
friend

Definition at line 34 of file WaitingTaskHolder.h.

friend class WaitingTaskWithArenaHolder
friend

Definition at line 35 of file WaitingTaskHolder.h.

Member Data Documentation

tbb::task_group* edm::WaitingTaskHolder::m_group
private

Definition at line 119 of file WaitingTaskHolder.h.

Referenced by doneWaiting(), group(), and operator=().

WaitingTask* edm::WaitingTaskHolder::m_task
private