CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
void push(tbb::task_group &, const T &iAction)
asynchronously pushes functor iAction into queue
void prefetchAsyncImpl(edm::WaitingTaskHolder iTask, edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::EventSetupImpl const *, edm::ServiceToken const &, edm::ESParentContext const &) final
void add(tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:68
tbb::task_group * group() const noexcept
virtual void prefetch(edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0