CMS 3D CMS Logo

CallOnceNoWait.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_CallOnceNoWait_h
2 #define FWCore_Utilities_CallOnceNoWait_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Utilities
6 // Class : CallOnceNoWait
7 //
27 //
28 // Original Author: Chris Jones
29 // Created: Fri, 15 Nov 2013 14:29:51 GMT
30 //
31 
32 // system include files
33 #include <atomic>
34 
35 // user include files
36 
37 // forward declarations
38 
39 namespace edm {
41  public:
43 
44  template <typename T>
45  void operator()(T iCall) {
46  bool expected = false;
47  if (m_called.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) {
48  iCall();
49  }
50  }
51 
52  private:
53  std::atomic<bool> m_called;
54  };
55 } // namespace edm
56 
57 #endif
funct::false
false
Definition: Factorize.h:34
edm::CallOnceNoWait::operator()
void operator()(T iCall)
Definition: CallOnceNoWait.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::CallOnceNoWait::CallOnceNoWait
CallOnceNoWait()
Definition: CallOnceNoWait.h:42
edm::CallOnceNoWait::m_called
std::atomic< bool > m_called
Definition: CallOnceNoWait.h:53
edm::CallOnceNoWait
Definition: CallOnceNoWait.h:40
T
long double T
Definition: Basic3DVectorLD.h:48