CMS 3D CMS Logo

WaitingService.h
Go to the documentation of this file.
1 #ifndef FWCore_Integration_WaitingService_h
2 #define FWCore_Integration_WaitingService_h
3 
4 #include "WaitingServer.h"
5 
6 #include <atomic>
7 #include <memory>
8 #include <vector>
9 
10 namespace edm {
11  class ActivityRegistry;
12  class ParameterSet;
13  namespace service {
14  class SystemBounds;
15  }
16 } // namespace edm
17 
18 namespace edmtest {
19  namespace test_acquire {
20 
21  class Token {
22  public:
23  Token(unsigned int v) : value_(v) {}
24  unsigned int value() const { return value_; }
25 
26  private:
27  unsigned int value_;
28  };
29 
31  public:
34 
35  Token getToken() { return Token(count_.fetch_add(1)); }
36 
38 
39  Cache* getCache(Token const& token) { return &caches_[token.value()]; }
40 
42  std::vector<int> const* iIn,
43  std::vector<int>* iOut,
45  server_->requestValuesAsync(token.value(), iIn, iOut, holder);
46  }
47 
48  void postEndJob();
49 
50  private:
51  std::atomic<unsigned int> count_;
52  std::vector<Cache> caches_;
53  std::unique_ptr<WaitingServer> server_;
54  const unsigned int numberOfStreamsToAccumulate_;
55  const unsigned int secondsToWaitForWork_;
56  };
57  } // namespace test_acquire
58 } // namespace edmtest
59 #endif
std::atomic< unsigned int > count_
void requestValuesAsync(Token const &token, std::vector< int > const *iIn, std::vector< int > *iOut, edm::WaitingTaskWithArenaHolder &holder)
std::unique_ptr< WaitingServer > server_
Cache * getCache(Token const &token)
const unsigned int numberOfStreamsToAccumulate_
HLT enums.
void preallocate(edm::service::SystemBounds const &)
WaitingService(edm::ParameterSet const &pset, edm::ActivityRegistry &iRegistry)
unsigned int value() const