ROSE  0.11.50.0
Periodic.h
1 #ifndef ROSE_BinaryAnalysis_ModelChecker_Periodic_H
2 #define ROSE_BinaryAnalysis_ModelChecker_Periodic_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/ModelChecker/Types.h>
7 #include <condition_variable>
8 #include <mutex>
9 #include <thread>
10 
11 namespace Rose {
12 namespace BinaryAnalysis {
13 namespace ModelChecker {
14 
21 class Periodic {
22 public:
23  using Ptr = PeriodicPtr;
24 private:
25  std::thread worker_;
26  std::mutex mutex_;
27  bool stopping_ = false;
28  std::condition_variable cv_;
29 
30 public:
31  virtual ~Periodic();
32  void start(const EnginePtr&, std::chrono::duration<double> period);
33  void stop();
34  virtual void step(const EnginePtr&) = 0;
35 private:
36  void run(const EnginePtr&, std::chrono::duration<double> period);
37 };
38 
39 } // namespace
40 } // namespace
41 } // namespace
42 
43 #endif
44 #endif
Main namespace for the ROSE library.
Do something periodically in another thread.
Definition: Periodic.h:21