CMS 3D CMS Logo

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

#include <WaitingTask.h>

Inheritance diagram for edm::WaitingTask:
edm::EmptyWaitingTask edm::FunctorWaitingTask< F > edm::Worker::RunModuleTask< T >

Public Member Functions

std::exception_ptr const * exceptionPtr () const
 Returns exception thrown by dependent task. More...
 
 WaitingTask ()
 Constructor. More...
 
 ~WaitingTask () override
 

Private Member Functions

void dependentTaskFailed (std::exception_ptr iPtr)
 Called if waited for task failed. More...
 

Private Attributes

std::atomic< std::exception_ptr * > m_ptr
 

Friends

class WaitingTaskHolder
 
class WaitingTaskList
 

Detailed Description

Definition at line 35 of file WaitingTask.h.

Constructor & Destructor Documentation

edm::WaitingTask::WaitingTask ( )
inline

Constructor.

Definition at line 42 of file WaitingTask.h.

42 : m_ptr{nullptr} {}
std::atomic< std::exception_ptr * > m_ptr
Definition: WaitingTask.h:72
edm::WaitingTask::~WaitingTask ( )
inlineoverride

Definition at line 43 of file WaitingTask.h.

References m_ptr.

43  {
44  delete m_ptr.load();
45  };
std::atomic< std::exception_ptr * > m_ptr
Definition: WaitingTask.h:72

Member Function Documentation

void edm::WaitingTask::dependentTaskFailed ( std::exception_ptr  iPtr)
inlineprivate

Called if waited for task failed.

Allows transfer of the exception caused by the dependent task to be moved to another thread. This method should only be called by WaitingTaskList

Definition at line 62 of file WaitingTask.h.

References m_ptr, and groupFilesInBlocks::temp.

Referenced by edm::WaitingTaskList::add(), and edm::WaitingTaskHolder::doneWaiting().

62  {
63  if (iPtr and not m_ptr) {
64  auto temp = std::make_unique<std::exception_ptr>(iPtr);
65  std::exception_ptr* expected = nullptr;
66  if( m_ptr.compare_exchange_strong(expected, temp.get()) ) {
67  temp.release();
68  }
69  }
70  }
std::atomic< std::exception_ptr * > m_ptr
Definition: WaitingTask.h:72
std::exception_ptr const* edm::WaitingTask::exceptionPtr ( ) const
inline

Returns exception thrown by dependent task.

If the value is non-null then the dependent task failed.

Definition at line 52 of file WaitingTask.h.

References m_ptr.

Referenced by edm::FunctorWaitingTask< F >::execute().

52  {
53  return m_ptr.load();
54  }
std::atomic< std::exception_ptr * > m_ptr
Definition: WaitingTask.h:72

Friends And Related Function Documentation

friend class WaitingTaskHolder
friend

Definition at line 39 of file WaitingTask.h.

friend class WaitingTaskList
friend

Definition at line 38 of file WaitingTask.h.

Member Data Documentation

std::atomic<std::exception_ptr*> edm::WaitingTask::m_ptr
private

Definition at line 72 of file WaitingTask.h.

Referenced by dependentTaskFailed(), exceptionPtr(), and ~WaitingTask().