A class for running a certain piece of code in a thread. More...
#include <rtt/os/RunnableInterface.hpp>
A class for running a certain piece of code in a thread.
It defines three methods for executing functionality. It allows to execute code in a PeriodicThreadInterface or SingleThreadInterface, which define the control methods as starting and stopping (periodic) threads.
In a start-run-stop cycle, before step() is called the first time, initialize() will be called in the thread that started this RunnableInterface. When step() is ran the last time in this cycle, finalize() will be called, after it finishes, in the threaad that stopped this RunnableInterface.
A non periodic thread will call loop(), which indicates that the RunnableInterface is allowed to block ( step() is not allowed to block ). By default, loop() calls step(), but a subclass may override the loop() method to put its own blocking functionality in. To break out of the loop() method, reimplement breakLoop() such that loop() returns when breakLoop() is called.
Definition at line 68 of file RunnableInterface.hpp.
Create a runnable object.
The optional constructor parameter allows the object to attach directly to a thread. Otherwise, ThreadInterface::run(RunnableInterface*) must be used to attach this object to a thread. A thread can only run one RunnableInterface object, use CoreLib tasks otherwise..
Get the thread this object is run in.
Reimplemented in RTT::RunnableInterface.
The method that will be executed once when this class RTT_API is run in a non periodic thread.
The default implementation calls step() once.
Reimplemented in RTT::Timer.