A thread which is being run (or runs a RunnableInterface). More...
#include <rtt/os/ThreadInterface.hpp>
Public Member Functions | |
virtual bool | run (RunnableInterface *r)=0 |
Run the functionality of one RunnableInterface object. | |
virtual bool | start ()=0 |
Start the Thread. | |
virtual bool | stop ()=0 |
Stop the Thread. | |
virtual Seconds | getPeriod () const =0 |
Get the periodicity in Seconds. | |
virtual bool | setPeriod (Seconds new_period)=0 |
Set the periodicity in Seconds. | |
virtual nsecs | getPeriodNS () const =0 |
Get the periodicity in nanoseconds. | |
virtual bool | isRunning () const =0 |
Returns whether the thread is running. | |
virtual bool | isActive () const =0 |
Returns whether the thread is active. | |
virtual const char * | getName () const =0 |
Read the name of this task. | |
virtual RTOS_TASK * | getTask ()=0 |
Get the RTOS_TASK pointer. | |
virtual bool | setScheduler (int sched_type)=0 |
Change the scheduler policy in which this thread runs. | |
virtual int | getScheduler () const =0 |
Get the scheduler policy in which this thread runs. | |
virtual bool | setPriority (int priority)=0 |
Set the priority of this Thread. | |
virtual int | getPriority () const =0 |
The priority of this Thread. | |
virtual void | yield ()=0 |
Yields (put to the back of the scheduler queue) the calling thread. | |
unsigned int | threadNumber () const |
The unique thread number (within the same process). | |
Protected Attributes | |
int | threadnb |
Threads are given an unique number, which follows thread creation order. |
A thread which is being run (or runs a RunnableInterface).
The periodicity is the time between the starting of two runs or zero for non periodic threads.
Definition at line 51 of file ThreadInterface.hpp.
virtual Seconds RTT::OS::ThreadInterface::getPeriod | ( | ) | const [pure virtual] |
Get the periodicity in Seconds.
Return zero if non periodic.
Implemented in RTT::Activity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual nsecs RTT::OS::ThreadInterface::getPeriodNS | ( | ) | const [pure virtual] |
Get the periodicity in nanoseconds.
Return zero if non periodic.
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual int RTT::OS::ThreadInterface::getPriority | ( | ) | const [pure virtual] |
The priority of this Thread.
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual int RTT::OS::ThreadInterface::getScheduler | ( | ) | const [pure virtual] |
Get the scheduler policy in which this thread runs.
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual RTOS_TASK* RTT::OS::ThreadInterface::getTask | ( | ) | [pure virtual] |
Get the RTOS_TASK pointer.
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::isActive | ( | ) | const [pure virtual] |
Returns whether the thread is active.
A thread is active between the invocation of start() and the invocation of stop().
Implemented in RTT::Activity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::isRunning | ( | ) | const [pure virtual] |
Returns whether the thread is running.
A thread is running if it is executing its loop() function or in the process of periodically calling step(). Hence for periodic threads, isRunning() == isActive() while for non-periodic threads, isRunning() is only true if isActive() and it is executing loop().
Implemented in RTT::Activity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, RTT::OS::Thread, and RTT::SimulationThread.
virtual bool RTT::OS::ThreadInterface::run | ( | RunnableInterface * | r | ) | [pure virtual] |
Run the functionality of one RunnableInterface object.
Only one RunnableInterface object can be run, the old one is disconnected.
r | The object to run or zero to clear. |
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::setPeriod | ( | Seconds | new_period | ) | [pure virtual] |
Set the periodicity in Seconds.
new_period | A positive number expressing the period |
Implemented in RTT::Activity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::setPriority | ( | int | priority | ) | [pure virtual] |
Set the priority of this Thread.
priority | The priority given upon construction of this thread. It has to be interpreted in the current OS scheduler. |
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::setScheduler | ( | int | sched_type | ) | [pure virtual] |
Change the scheduler policy in which this thread runs.
sched_type | An OS-specific value which selects a scheduler. Orocos requires that these two values are available: |
Your OS can in addition provide other sched_type's which map more naturally to the schedulers present. If your OS does not make a distinction between real-time and other, both values may map to the same scheduler type.
Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
virtual bool RTT::OS::ThreadInterface::start | ( | ) | [pure virtual] |
Start the Thread.
Implemented in RTT::Activity, RTT::EventDrivenActivity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, RTT::OS::Thread, and RTT::SimulationThread.
virtual bool RTT::OS::ThreadInterface::stop | ( | ) | [pure virtual] |
Stop the Thread.
Implemented in RTT::Activity, RTT::EventDrivenActivity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::OS::Thread.
int RTT::OS::ThreadInterface::threadnb [protected] |
Threads are given an unique number, which follows thread creation order.
Definition at line 191 of file ThreadInterface.hpp.