Go to the documentation of this file. 1 #ifndef AIKIDO_COMMON_EXECUTORTHREAD_HPP_
2 #define AIKIDO_COMMON_EXECUTORTHREAD_HPP_
35 template <
typename Duration>
36 ExecutorThread(std::function<
void()> callback,
const Duration& period);
71 #endif // AIKIDO_COMMON_EXECUTORTHREAD_HPP_
void stop()
Stops the thread.
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
void spin()
The loop function that will be executed by the thread.
std::chrono::milliseconds mPeriod
The callback is called in this period.
Definition: ExecutorThread.hpp:57
bool isRunning() const
Returns true if the thread is running.
ExecutorThread(std::function< void()> callback, const Duration &period)
Constructs from callback and period.
Definition: ExecutorThread-impl.hpp:8
std::function< void()> mCallback
Callback to be periodically executed by the thread.
Definition: ExecutorThread.hpp:54
~ExecutorThread()
Default destructor. The thread stops as ExecutorThread is destructed.
std::atomic< bool > mIsRunning
Flag whether the thread is running.
Definition: ExecutorThread.hpp:60
ExecutorThread is a wrapper of std::thread that calls a callback periodically.
Definition: ExecutorThread.hpp:28
std::thread mThread
Thread.
Definition: ExecutorThread.hpp:63