RTT::OS::ThreadInterface Class Reference

A thread which is being run (or runs a RunnableInterface). More...

#include <rtt/os/ThreadInterface.hpp>

Inheritance diagram for RTT::OS::ThreadInterface:

RTT::OS::MainThread RTT::OS::PeriodicThread RTT::OS::SingleThread RTT::TimerThread RTT::NonPeriodicActivity RTT::SimulationThread RTT::CompletionProcessor RTT::EventDrivenActivity

List of all members.

Public Types

typedef double Seconds
typedef long secs
typedef long msecs
typedef long long nsecs

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 nsecs getPeriodNS () const =0
 Get the periodicity in nanoseconds.
virtual bool isRunning () const =0
 Returns whether the thread is running.
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 (but to the back of the scheduler queue) the calling thread.
unsigned int threadNumber () const
 The unique thread number.

Protected Attributes

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


Detailed Description

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 53 of file ThreadInterface.hpp.


Member Function Documentation

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

Get the periodicity in Seconds.

Return zero if non periodic.

Implemented in RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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, and RTT::OS::SingleThread.

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::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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.

Parameters:
r The object to run or zero to clear.
Returns:
true if accepted, false if the thread is running.

Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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

Set the priority of this Thread.

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

Implemented in RTT::OS::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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

Change the scheduler policy in which this thread runs.

Parameters:
sched_type An 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::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.

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::EventDrivenActivity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, RTT::OS::SingleThread, and RTT::SimulationThread.

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::EventDrivenActivity, RTT::NonPeriodicActivity, RTT::OS::MainThread, RTT::OS::PeriodicThread, and RTT::OS::SingleThread.


Member Data Documentation

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

See also:
OS::threads

Definition at line 182 of file ThreadInterface.hpp.

Referenced by threadNumber().


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

Generated on Tue Aug 25 14:17:26 2009 for Orocos Real-Time Toolkit by  doxygen 1.5.8