Files
PresenceDetection/Util/Timer.h
T
2018-12-18 12:07:12 +01:00

32 lines
456 B
C++

#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