MainThread Class Reference

#include <rtt/os/MainThread.hpp>

Inheritance diagram for MainThread:

ThreadInterface

List of all members.


Detailed Description

A class which represents the main() thread.

Definition at line 52 of file MainThread.hpp.


Public Types

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

Public Member Functions

virtual ~MainThread ()
virtual bool run (OS::RunnableInterface *r)
 Always fails.
virtual bool start ()
 Always fails.
virtual bool stop ()
 Always fails.
virtual Seconds getPeriod () const
 Returns zero.
virtual nsecs getPeriodNS () const
 Returns zero.
virtual bool isRunning () const
 Returns always true.
virtual const char * getName () const
 Returns "main".
virtual RTOS_TASKgetTask ()
 Get the RTOS_TASK pointer.
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 yield ()
 Yields (but to the back of the scheduler queue) the calling thread.
unsigned int threadNumber () const
 Returns zero, the number of the main() thread.

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.

Member Function Documentation

ThreadInterface * Instance (  )  [static]

Return an object which represents the main thread.

Only after this call, OS calls may be done.

Definition at line 60 of file MainThread.cpp.

Referenced by SlaveActivity::thread().

void Release (  )  [static]

This is called to cleanup the main thread.

After this call, no OS calls may be done.

Definition at line 68 of file MainThread.cpp.

RTOS_TASK * 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 ThreadInterface.

Definition at line 87 of file MainThread.cpp.

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

Implements ThreadInterface.

Definition at line 89 of file MainThread.cpp.

int 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 ThreadInterface.

Definition at line 95 of file MainThread.cpp.

bool setPriority ( int  priority  )  [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

Implements ThreadInterface.

Definition at line 100 of file MainThread.cpp.

int 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 ThreadInterface.

Definition at line 105 of file MainThread.cpp.


Member Data Documentation

int threadnb [protected, inherited]

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 ThreadInterface::ThreadInterface(), and ThreadInterface::threadNumber().


The documentation for this class was generated from the following files:
Generated on Tue Mar 25 17:42:02 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3