CMS 3D CMS Logo

ESSourceDataProxyBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : __class__
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: __author__
10 // Created: __date__
11 //
12 
13 // system include files
14 
15 // user include files
20 
21 //
22 // member functions
23 //
24 
27  edm::eventsetup::DataKey const& iKey,
28  edm::EventSetupImpl const*,
29  edm::ServiceToken const&,
30  edm::ESParentContext const& iParent) {
31  bool expected = false;
32  auto doPrefetch = m_prefetching.compare_exchange_strong(expected, true);
33  m_waitingList.add(iTask);
34  if (doPrefetch) {
35  m_queue->push(*iTask.group(), [this, iKey, &iRecord, iParent]() {
36  try {
37  {
38  std::lock_guard<std::mutex> guard(*m_mutex);
40  iRecord.activityRegistry()->preESModuleSignal_.emit(iRecord.key(), context);
41  struct EndGuard {
42  EndGuard(EventSetupRecordImpl const& iRecord, ESModuleCallingContext const& iContext)
43  : record_{iRecord}, context_{iContext} {}
44  ~EndGuard() { record_.activityRegistry()->postESModuleSignal_.emit(record_.key(), context_); }
45  EventSetupRecordImpl const& record_;
46  ESModuleCallingContext const& context_;
47  } guardAR(iRecord, context);
48  prefetch(iKey, EventSetupRecordDetails(&iRecord));
49  }
50  m_waitingList.doneWaiting(std::exception_ptr{});
51  } catch (...) {
52  m_waitingList.doneWaiting(std::current_exception());
53  }
54  });
55  }
56 }
57 
58 //
59 // const member functions
60 //
61 
62 //
63 // static member functions
64 //
edm::ESModuleCallingContext
Definition: ESModuleCallingContext.h:27
edm::EventSetupImpl
Definition: EventSetupImpl.h:49
edm::eventsetup::ESSourceDataProxyBase::m_mutex
std::mutex * m_mutex
Definition: ESSourceDataProxyBase.h:68
edm::eventsetup::DataKey
Definition: DataKey.h:29
edm::SerialTaskQueue::push
void push(tbb::task_group &, const T &iAction)
asynchronously pushes functor iAction into queue
Definition: SerialTaskQueue.h:167
ActivityRegistry.h
edm::ServiceToken
Definition: ServiceToken.h:42
edm::eventsetup::ESSourceDataProxyBase::m_queue
edm::SerialTaskQueue * m_queue
Definition: ESSourceDataProxyBase.h:67
edm::EventSetupRecordDetails
Definition: EventSetupRecordDetails.h:29
edm::WaitingTaskList::doneWaiting
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
Definition: WaitingTaskList.cc:212
ESSourceDataProxyBase.h
edm::eventsetup::EventSetupRecordImpl
Definition: EventSetupRecordImpl.h:77
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
DataKey.h
edm::eventsetup::DataProxy::providerDescription
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:68
edm::ESParentContext
Definition: ESParentContext.h:21
edm::WaitingTaskList::add
void add(tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
Definition: WaitingTaskList.cc:125
edm::eventsetup::ESSourceDataProxyBase::m_waitingList
edm::WaitingTaskList m_waitingList
Definition: ESSourceDataProxyBase.h:66
edm::eventsetup::ESSourceDataProxyBase::prefetchAsyncImpl
void prefetchAsyncImpl(edm::WaitingTaskHolder iTask, edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::EventSetupImpl const *, edm::ServiceToken const &, edm::ESParentContext const &) final
Definition: ESSourceDataProxyBase.cc:25
edm::eventsetup::ESSourceDataProxyBase::prefetch
virtual void prefetch(edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0
edm::ESModuleCallingContext::State::kRunning
edm::WaitingTaskHolder::group
tbb::task_group * group() const noexcept
Definition: WaitingTaskHolder.h:77
edm::eventsetup::ESSourceDataProxyBase::m_prefetching
std::atomic< bool > m_prefetching
Definition: ESSourceDataProxyBase.h:69
ESModuleCallingContext.h