Initial Commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef UTIL_TIMER_H
|
||||
#define UTIL_TIMER_H
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
|
||||
namespace PresenceDetection {
|
||||
namespace Util {
|
||||
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer();
|
||||
~Timer();
|
||||
|
||||
void Start(int interval, std::function<void(void)> func);
|
||||
void Stop();
|
||||
bool IsRunning() const noexcept;
|
||||
void Wait();
|
||||
|
||||
private:
|
||||
std::atomic<bool> m_run;
|
||||
std::thread m_thread;
|
||||
};
|
||||
|
||||
} // namespace Util
|
||||
} // namespace PresenceDetection
|
||||
|
||||
#endif // UTIL_TIMER_H
|
||||
Reference in New Issue
Block a user