This class extends threads by the ability to execute an operation repeatedly in an defined interval.
More...
#include <thread/CyclicRunnable.h>
This class extends threads by the ability to execute an operation repeatedly in an defined interval.
By binding the operator() of this class to a boost thread the given functor is executed in the given interval.
boost::thread t(boost::ref(cyclic));
- Note
- If the operation that is processed repeatedly takes more time than the specified interval, the interval cannot be hold and the operation is called as fast as possible.
◆ CyclicRunnable() [1/2]
CyclicRunnable |
( |
boost::function< void()> |
fn, |
|
|
const std::string & |
name = "" |
|
) |
| |
|
inline |
Constructs a CyclicRunnable with given functor.
This uses a default interval of 1 second
- Parameters
-
[in] | fn | The function to execute repeatedly. |
[in] | name | The optional name of the thread that is registered in the Threadmanager. |
◆ CyclicRunnable() [2/2]
Constructs a CyclicRunnable with given functor and interval.
- Parameters
-
[in] | fn | The function to execute repeatedly. |
[in] | interval | The interval (cycle time) between each execution of fn. |
[in] | name | The optional name of the thread that is registered in the Threadmanager. |
◆ operator()()
Bind this to a thread to execute the given functor in the specified interval.
◆ cycleTime
The cycle time, this cyclic runnable calls its assigned function.
The documentation for this class was generated from the following file: