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
std::atomic< bool > m_called
HLT enums.
void operator()(T iCall)
long double T