ROSE  0.11.145.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_MODEL_CHECKER
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 
34  void start(const EnginePtr&, std::chrono::duration<double> period);
35 
37  void stop();
38 
42  virtual void step(const EnginePtr&) = 0;
43 
44 private:
45  void run(const EnginePtr&, std::chrono::duration<double> period);
46 };
47 
48 } // namespace
49 } // namespace
50 } // namespace
51 
52 #endif
53 #endif
Main namespace for the ROSE library.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.