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
18 
19 //
20 // member functions
21 //
22 
25  edm::eventsetup::DataKey const& iKey,
26  edm::EventSetupImpl const*,
27  edm::ServiceToken const&) {
28  bool expected = false;
29  auto doPrefetch = m_prefetching.compare_exchange_strong(expected, true);
30  m_waitingList.add(iTask);
31  if (doPrefetch) {
32  m_queue->push([this, iKey, &iRecord]() {
33  try {
34  {
35  std::lock_guard<std::mutex> guard(*m_mutex);
36  prefetch(iKey, EventSetupRecordDetails(&iRecord));
37  }
38  m_waitingList.doneWaiting(std::exception_ptr{});
39  } catch (...) {
40  m_waitingList.doneWaiting(std::current_exception());
41  }
42  });
43  }
44 }
45 
46 //
47 // const member functions
48 //
49 
50 //
51 // static member functions
52 //
edm::EventSetupImpl
Definition: EventSetupImpl.h:48
edm::eventsetup::ESSourceDataProxyBase::m_mutex
std::mutex * m_mutex
Definition: ESSourceDataProxyBase.h:67
edm::WaitingTaskList::add
void add(WaitingTask *)
Adds task to the waiting list.
Definition: WaitingTaskList.cc:90
edm::eventsetup::DataKey
Definition: DataKey.h:29
edm::ServiceToken
Definition: ServiceToken.h:40
edm::eventsetup::ESSourceDataProxyBase::m_queue
edm::SerialTaskQueue * m_queue
Definition: ESSourceDataProxyBase.h:66
edm::SerialTaskQueue::push
void push(const T &iAction)
asynchronously pushes functor iAction into queue
Definition: SerialTaskQueue.h:187
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:170
ESSourceDataProxyBase.h
edm::eventsetup::EventSetupRecordImpl
Definition: EventSetupRecordImpl.h:76
DataKey.h
edm::eventsetup::ESSourceDataProxyBase::m_waitingList
edm::WaitingTaskList m_waitingList
Definition: ESSourceDataProxyBase.h:65
edm::WaitingTask
Definition: WaitingTask.h:36
edm::eventsetup::ESSourceDataProxyBase::prefetchAsyncImpl
void prefetchAsyncImpl(edm::WaitingTask *iTask, edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::EventSetupImpl const *, edm::ServiceToken const &) final
Definition: ESSourceDataProxyBase.cc:23
edm::eventsetup::ESSourceDataProxyBase::prefetch
virtual void prefetch(edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0
edm::eventsetup::ESSourceDataProxyBase::m_prefetching
std::atomic< bool > m_prefetching
Definition: ESSourceDataProxyBase.h:68