1 #ifndef PERIODIC_TIMER_HPP 2 #define PERIODIC_TIMER_HPP 21 const double period_seconds);
49 void setPeriod(
const double& period_seconds);
54 std::chrono::duration<size_t, std::micro>
period_us;
56 std::chrono::steady_clock::time_point
tstart;
bool start()
start define and start background thread
std::atomic_flag running_
bool stop()
stop tell thread to stop and wait for end
~PeriodicTimer()
PeriodicTimer destructor.
std::function< void()> funct
void setPeriod(const double &period_seconds)
setPeriod change the update period of timer thread This will stop and restart the thread...
std::shared_ptr< std::thread > thread_ptr
std::chrono::duration< size_t, std::micro > period_us
std::timed_mutex mutex_timer
std::chrono::steady_clock::time_point tstart
double getPeriod() const
getPeriod get period in seconds
PeriodicTimer(const std::function< void()> funct, const double period_seconds)
PeriodicTimer define a periodic timer.