Orocos Real-Time Toolkit  2.5.0
Public Member Functions | Static Public Member Functions | Protected Attributes
RTT::os::MainThread Class Reference

A class which represents the main() thread. More...

#include <rtt/os/MainThread.hpp>

Inheritance diagram for RTT::os::MainThread:
RTT::os::ThreadInterface

List of all members.

Public Member Functions

virtual bool start ()
 Always fails.
virtual bool stop ()
 Always fails.
virtual Seconds getPeriod () const
 Returns zero.
virtual bool setPeriod (Seconds period)
 Returns always false.
virtual nsecs getPeriodNS () const
 Returns zero.
virtual bool isRunning () const
 Returns always true.
virtual bool isActive () const
 Returns always true.
virtual const char * getName () const
 Returns "main".
virtual RTOS_TASK * getTask ()
 Get the RTOS_TASK pointer.
virtual const RTOS_TASK * getTask () const
 const version of the above.
virtual bool setScheduler (int sched_type)
 Change the scheduler policy in which this thread runs.
virtual int getScheduler () const
 Get the scheduler policy in which this thread runs.
virtual bool setPriority (int priority)
 Set the priority of this Thread.
virtual int getPriority () const
 The priority of this Thread.
virtual void setMaxOverrun (int m)
virtual int getMaxOverrun () const
virtual void setWaitPeriodPolicy (int p)
 Set the wait policy of a periodic thread.
virtual void yield ()
 Yields (put to the back of the scheduler queue) the calling thread.
unsigned int threadNumber () const
 Returns zero, the number of the main() thread.
bool isSelf () const

Static Public Member Functions

static ThreadInterfaceInstance ()
 Return an object which represents the main thread.
static void Release ()
 This is called to cleanup the main thread.

Protected Attributes

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

Detailed Description

A class which represents the main() thread.

Definition at line 52 of file MainThread.hpp.


Member Function Documentation

int RTT::os::MainThread::getPriority ( ) const [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

Implements RTT::os::ThreadInterface.

Definition at line 104 of file MainThread.cpp.

References RTT::os::rtos_task_get_priority().

int RTT::os::MainThread::getScheduler ( ) const [virtual]

Get the scheduler policy in which this thread runs.

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

Implements RTT::os::ThreadInterface.

Definition at line 94 of file MainThread.cpp.

References RTT::os::rtos_task_get_scheduler().

RTOS_TASK * RTT::os::MainThread::getTask ( ) [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.

Implements RTT::os::ThreadInterface.

Definition at line 84 of file MainThread.cpp.

Return an object which represents the main thread.

Only after this call, OS calls may be done.

Definition at line 58 of file MainThread.cpp.

Referenced by __os_init(), RTT::extras::SequentialActivity::thread(), and RTT::extras::SlaveActivity::thread().

void RTT::os::MainThread::Release ( ) [static]

This is called to cleanup the main thread.

After this call, no OS calls may be done.

Definition at line 66 of file MainThread.cpp.

Referenced by __os_exit().

bool RTT::os::MainThread::setPriority ( int  priority) [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

Implements RTT::os::ThreadInterface.

Definition at line 99 of file MainThread.cpp.

References RTT::os::rtos_task_set_priority().

bool RTT::os::MainThread::setScheduler ( int  sched_type) [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.

Implements RTT::os::ThreadInterface.

Definition at line 88 of file MainThread.cpp.

References RTT::os::rtos_task_set_scheduler().

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

Set the wait policy of a periodic thread.

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

Implements RTT::os::ThreadInterface.

Definition at line 123 of file MainThread.cpp.

References RTT::os::rtos_task_set_wait_period_policy().


Member Data Documentation

int RTT::os::ThreadInterface::threadnb [protected, inherited]

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

See also:
os::threads

Definition at line 211 of file ThreadInterface.hpp.


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