CMS 3D CMS Logo

Async.h
Go to the documentation of this file.
1 #ifndef FWCore_Concurrency_Async_h
2 #define FWCore_Concurrency_Async_h
3 
6 
7 namespace edm {
8  // All member functions are thread safe
9  class Async {
10  public:
11  Async() = default;
12  virtual ~Async() noexcept;
13 
14  // prevent copying and moving
15  Async(Async const&) = delete;
16  Async(Async&&) = delete;
17  Async& operator=(Async const&) = delete;
18  Async& operator=(Async&&) = delete;
19 
20  template <typename F, typename G>
21  void runAsync(WaitingTaskWithArenaHolder holder, F&& func, G&& errorContextFunc) {
22  ensureAllowed();
23  pool_.runAsync(std::move(holder), std::forward<F>(func), std::forward<G>(errorContextFunc));
24  }
25 
26  protected:
27  virtual void ensureAllowed() const = 0;
28 
29  private:
31  };
32 } // namespace edm
33 
34 #endif
Async()=default
Async & operator=(Async const &)=delete
void runAsync(WaitingTaskWithArenaHolder holder, F &&func, G &&errorContextFunc)
Definition: Async.h:21
void runAsync(WaitingTaskWithArenaHolder holder, F &&func, G &&errorContextFunc)
WaitingThreadPool pool_
Definition: Async.h:30
HLT enums.
virtual ~Async() noexcept
virtual void ensureAllowed() const =0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
def move(src, dest)
Definition: eostools.py:511