BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
SingleInstanceChecker.h
1 #pragma once
2 
3 #include <string>
4 
5 #include <Poco/NamedMutex.h>
6 #include <Poco/SharedPtr.h>
7 
8 #include "util/Loggable.h"
9 
10 namespace BeeeOn {
11 
32 class SingleInstanceChecker : protected Loggable {
33 public:
34  enum Mode {
38  };
39 
42 
43  void setName(const std::string &name);
44  void setMode(const std::string &mode);
45 
51  void check();
52 
53 private:
54  std::string m_name;
55  Mode m_mode;
56  Poco::SharedPtr<Poco::NamedMutex> m_lock;
57 };
58 
59 }
Mode
Definition: SingleInstanceChecker.h:34
Definition: SingleInstanceChecker.h:37
Definition: Loggable.h:19
SingleInstanceChecker can detect another equivalent running application instance. This might prevent ...
Definition: SingleInstanceChecker.h:32
Definition: SingleInstanceChecker.h:36
Definition: SingleInstanceChecker.h:35
void check()
Try lock the global mutex. If it successfully locks, jsut continue. Otherwise, based on the configure...
Definition: SingleInstanceChecker.cpp:57