Orocos Real-Time Toolkit
2.8.3
|
A thread which is being run. More...
#include <rtt/os/ThreadInterface.hpp>
Public Member Functions | |
ThreadInterface () | |
virtual | ~ThreadInterface () |
virtual bool | start ()=0 |
Start the Thread. More... | |
virtual bool | stop ()=0 |
Stop the Thread. More... | |
virtual Seconds | getPeriod () const =0 |
Get the periodicity in Seconds. More... | |
virtual bool | setPeriod (Seconds new_period)=0 |
Set the periodicity in Seconds. More... | |
virtual nsecs | getPeriodNS () const =0 |
Get the periodicity in nanoseconds. More... | |
virtual bool | isRunning () const =0 |
Returns whether the thread is running. More... | |
virtual bool | isActive () const =0 |
Returns whether the thread is active. More... | |
virtual const char * | getName () const =0 |
Read the name of this task. More... | |
virtual RTOS_TASK * | getTask ()=0 |
Get the RTOS_TASK pointer. More... | |
virtual const RTOS_TASK * | getTask () const =0 |
const version of the above. More... | |
virtual bool | setScheduler (int sched_type)=0 |
Change the scheduler policy in which this thread runs. More... | |
virtual int | getScheduler () const =0 |
Get the scheduler policy in which this thread runs. More... | |
virtual bool | setPriority (int priority)=0 |
Set the priority of this Thread. More... | |
virtual int | getPriority () const =0 |
The priority of this Thread. More... | |
virtual unsigned int | getPid () const =0 |
Returns the Process or Thread ID of this thread, as assigned by the Operating System. More... | |
virtual unsigned | getCpuAffinity () const =0 |
virtual void | setMaxOverrun (int m)=0 |
virtual int | getMaxOverrun () const =0 |
virtual void | setWaitPeriodPolicy (int p)=0 |
Set the wait policy of a periodic thread. More... | |
virtual void | yield ()=0 |
Yields (put to the back of the scheduler queue) the calling thread. More... | |
unsigned int | threadNumber () const |
The unique thread number (within the same process). More... | |
bool | isSelf () const |
Protected Attributes | |
int | threadnb |
Threads are given an unique number, which follows thread creation order. More... | |
A thread which is being run.
The periodicity is the time between the starting of two runs or zero for non periodic threads.
Definition at line 56 of file ThreadInterface.hpp.
ThreadInterface::ThreadInterface | ( | ) |
Definition at line 45 of file ThreadInterface.cpp.
References RTT::os::AtomicInt::inc(), RTT::os::AtomicInt::read(), threadnb, and RTT::os::threads.
|
virtual |
Definition at line 51 of file ThreadInterface.cpp.
|
pure virtual |
Implemented in RTT::os::Thread, RTT::Activity, and RTT::os::MainThread.
Referenced by RTT::extras::TimerThread::Instance().
|
pure virtual |
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Read the name of this task.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Get the periodicity in Seconds.
Return zero if non periodic.
Implemented in RTT::os::Thread, RTT::extras::FileDescriptorActivity, RTT::Activity, and RTT::os::MainThread.
|
pure virtual |
Get the periodicity in nanoseconds.
Return zero if non periodic.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Returns the Process or Thread ID of this thread, as assigned by the Operating System.
This function tries to return the Thread ID, if the OS supports it, otherwise it returns the process ID. If that is not available either, zero is returned. On Linux systems for example, the Thread ID of the main thread is equal to the Process ID. The Thread ID of every newly created thread is different from the Process ID (and unique).
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
The priority of this Thread.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Get the scheduler policy in which this thread runs.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Get the RTOS_TASK pointer.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
Referenced by isSelf().
|
pure virtual |
const version of the above.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
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::os::Thread, RTT::Activity, and RTT::os::MainThread.
|
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::os::Thread, RTT::extras::FileDescriptorActivity, RTT::Activity, RTT::os::MainThread, and RTT::extras::SimulationThread.
bool ThreadInterface::isSelf | ( | ) | const |
Definition at line 58 of file ThreadInterface.cpp.
References getTask(), and RTT::os::rtos_task_is_self().
|
pure virtual |
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Set the periodicity in Seconds.
new_period | A positive number expressing the period |
Implemented in RTT::extras::FileDescriptorActivity, RTT::Activity, RTT::os::Thread, and RTT::os::MainThread.
|
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::Thread, and RTT::os::MainThread.
|
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::Thread, and RTT::os::MainThread.
|
pure virtual |
Set the wait policy of a periodic thread.
The | wait policy between ORO_WAIT_ABS (absolute wait) and ORO_WAIT_REL (relative wait) |
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
pure virtual |
Start the Thread.
Implemented in RTT::extras::FileDescriptorActivity, RTT::Activity, RTT::os::Thread, RTT::extras::IRQActivity, RTT::extras::SimulationThread, and RTT::os::MainThread.
|
pure virtual |
Stop the Thread.
Implemented in RTT::extras::FileDescriptorActivity, RTT::Activity, RTT::os::Thread, and RTT::os::MainThread.
|
inline |
The unique thread number (within the same process).
Definition at line 216 of file ThreadInterface.hpp.
Referenced by RTT::os::Thread::Thread(), and RTT::os::thread_function().
|
pure virtual |
Yields (put to the back of the scheduler queue) the calling thread.
Implemented in RTT::os::Thread, and RTT::os::MainThread.
|
protected |
Threads are given an unique number, which follows thread creation order.
Definition at line 228 of file ThreadInterface.hpp.
Referenced by ThreadInterface().