|virtual bool||breakLoop ()|
|virtual void||finalize ()=0|
|ActivityInterface *||getActivity () const|
|Query for the task this interface is run in. |
|virtual os::ThreadInterface *||getThread () const|
|virtual bool||hasWork ()|
|virtual bool||initialize ()=0|
|virtual void||loop ()|
|virtual void||setActivity (ActivityInterface *task)|
|Set the task this interface is run in. |
|virtual void||step ()=0|
A class for running a certain piece of code in a thread.
It defines three methods which can execute functionality.
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.
The getActivity() method is guaranteed to return a valid task pointer during initialize(), step() or loop() and finalize(). This allows the RunnableInterface to query the task's period(icity) and ThreadInterface. Consequently, initialize() knows whether step() or loop() will be called ( depending on ActivityInterface::isPeriodic() ).
Create a runnable object. The optional constructor parameter allows the object to attach directly to a thread. Otherwise, os::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.
|t||The thread this object must attach to.|
This method is called by the framework to break out of the loop() method. Reimplement this method to signal loop() to return and return true on success. When this method is not reimplemented by you, it will always return false, denoting that the loop can not be broken. If breakLoop() returns true, the caller will wait until loop() returns.
|virtual void RTT::base::RunnableInterface::finalize||(||)||
This method is for 'intelligent' activity implementations that wish to see if it is required to call step() (again). By default, false is returned. You should only return true in case there is a temporary reason to (re-)run step.
Reimplemented in RTT::ExecutionEngine.
|virtual bool RTT::base::RunnableInterface::initialize||(||)||
|virtual void RTT::base::RunnableInterface::step||(||)||