Public Member Functions | Protected Attributes
RTT::os::ThreadInterface Class Reference

#include <ThreadInterface.hpp>

Inheritance diagram for RTT::os::ThreadInterface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual int getMaxOverrun () const =0
virtual const char * getName () const =0
virtual Seconds getPeriod () const =0
virtual nsecs getPeriodNS () const =0
virtual unsigned int getPid () const =0
virtual int getPriority () const =0
virtual int getScheduler () const =0
virtual RTOS_TASKgetTask ()=0
virtual const RTOS_TASKgetTask () const =0
virtual bool isActive () const =0
virtual bool isRunning () const =0
bool isSelf () const
virtual void setMaxOverrun (int m)=0
virtual bool setPeriod (Seconds new_period)=0
virtual bool setPriority (int priority)=0
virtual bool setScheduler (int sched_type)=0
virtual void setWaitPeriodPolicy (int p)=0
virtual bool start ()=0
virtual bool stop ()=0
 ThreadInterface ()
unsigned int threadNumber () const
virtual void yield ()=0
virtual ~ThreadInterface ()

Protected Attributes

int threadnb

Detailed Description

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.


Constructor & Destructor Documentation

Definition at line 45 of file ThreadInterface.cpp.

Definition at line 51 of file ThreadInterface.cpp.


Member Function Documentation

virtual int RTT::os::ThreadInterface::getMaxOverrun ( ) const [pure virtual]

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual const char* RTT::os::ThreadInterface::getName ( ) const [pure virtual]

Read the name of this task

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual Seconds RTT::os::ThreadInterface::getPeriod ( ) const [pure virtual]

Get the periodicity in Seconds. Return zero if non periodic.

Implemented in RTT::os::Thread, RTT::Activity, and RTT::os::MainThread.

virtual nsecs RTT::os::ThreadInterface::getPeriodNS ( ) const [pure virtual]

Get the periodicity in nanoseconds. Return zero if non periodic.

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual unsigned int RTT::os::ThreadInterface::getPid ( ) const [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.

virtual int RTT::os::ThreadInterface::getPriority ( ) const [pure virtual]

The priority of this Thread.

Returns:
The priority given upon construction of this thread or set with setPriority. The returned number has to be interpreted in the current OS scheduler.
See also:
setScheduler

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual int RTT::os::ThreadInterface::getScheduler ( ) const [pure virtual]

Get the scheduler policy in which this thread runs.

Returns:
An OS-specific value which represents the used scheduler.
See also:
setScheduler

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual RTOS_TASK* RTT::os::ThreadInterface::getTask ( ) [pure virtual]

Get the RTOS_TASK pointer.

Note:
Using this function leads to non-portable code. It is here for users which wish to tweak OS specific thread settings.

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual const RTOS_TASK* RTT::os::ThreadInterface::getTask ( ) const [pure virtual]

const version of the above.

Implemented in RTT::os::Thread, and RTT::os::MainThread.

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::os::Thread, RTT::Activity, and RTT::os::MainThread.

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::os::Thread, RTT::Activity, RTT::extras::FileDescriptorActivity, RTT::os::MainThread, and RTT::extras::SimulationThread.

bool ThreadInterface::isSelf ( ) const

Definition at line 58 of file ThreadInterface.cpp.

virtual void RTT::os::ThreadInterface::setMaxOverrun ( int  m) [pure virtual]

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual bool RTT::os::ThreadInterface::setPeriod ( Seconds  new_period) [pure virtual]

Set the periodicity in Seconds.

Parameters:
new_periodA positive number expressing the period
Returns:
true if it was accepted, false otherwise.

Implemented in RTT::os::Thread, RTT::Activity, and RTT::os::MainThread.

virtual bool RTT::os::ThreadInterface::setPriority ( int  priority) [pure virtual]

Set the priority of this Thread.

Parameters:
priorityThe priority given upon construction of this thread. It has to be interpreted in the current OS scheduler.
See also:
setScheduler

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual bool RTT::os::ThreadInterface::setScheduler ( int  sched_type) [pure virtual]

Change the scheduler policy in which this thread runs.

Parameters:
sched_typeAn OS-specific value which selects a scheduler. Orocos requires that these two values are available:
  • ORO_SCHED_RT: Hint the OS that this thread should be scheduled as a priority or real-time process.
  • ORO_SCHED_OTHER: Hint the OS that this thread should not be scheduled as a priority or real-time process.

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.

Returns:
true if the change could be made.

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual void RTT::os::ThreadInterface::setWaitPeriodPolicy ( int  p) [pure virtual]

Set the wait policy of a periodic thread

Parameters:
Thewait policy between ORO_WAIT_ABS (absolute wait) and ORO_WAIT_REL (relative wait)

Implemented in RTT::os::Thread, and RTT::os::MainThread.

virtual bool RTT::os::ThreadInterface::start ( ) [pure virtual]

Start the Thread.

Postcondition:
initialize() is called first
The Thread is running
Returns:
true if the function did succeed. false otherwise.

Implemented in RTT::extras::FileDescriptorActivity, RTT::os::Thread, RTT::Activity, RTT::extras::IRQActivity, RTT::extras::SimulationThread, and RTT::os::MainThread.

virtual bool RTT::os::ThreadInterface::stop ( ) [pure virtual]

Stop the Thread.

Postcondition:
The Thread is no longer being run
finalize() is called when the Thread is stopped.
Returns:
true if the function did succeed. false otherwise.

Implemented in RTT::extras::FileDescriptorActivity, RTT::os::Thread, RTT::Activity, and RTT::os::MainThread.

unsigned int RTT::os::ThreadInterface::threadNumber ( ) const [inline]

The unique thread number (within the same process).

Reimplemented in RTT::os::MainThread.

Definition at line 211 of file ThreadInterface.hpp.

virtual void RTT::os::ThreadInterface::yield ( ) [pure virtual]

Yields (put to the back of the scheduler queue) the calling thread.

Implemented in RTT::os::Thread, and RTT::os::MainThread.


Member Data Documentation

Threads are given an unique number, which follows thread creation order.

See also:
os::threads

Definition at line 223 of file ThreadInterface.hpp.


The documentation for this class was generated from the following files:


rtt
Author(s): RTT Developers
autogenerated on Thu Jan 2 2014 11:35:45