Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Thread Class Reference

#include <Thread.h>

Inheritance diagram for Thread:

Commander SIR UI List of all members.

Detailed Description

Base class from which all multithreaded classes are derived. The derived classes inherit a set of methods that can be used to control the thread. Once the thread is spawned and made ready the run method is scheduled for execution. The run method is declared as virtual and has to be overwritten by the inheritor.
Jia L. Du

Public Member Functions

 Thread (char *name, int stackSize, int priority, int id)
bool spawn ()
void ready ()
void suspend ()
void kill ()

Protected Member Functions

void reschedule ()
void sleep (int hundrethSeconds)

Static Protected Member Functions

void run ()

Protected Attributes

tcb * threadControlBlock
char * name
int stackSize
int priority
int id

Constructor & Destructor Documentation

Thread::Thread char *    name,
int    stackSize,
int    priority,
int    id

Constructor for Thread

name pointer to thread name
stackSize size of thread stack
priority thread priority (valid values are: MIN_ PRI to MAX_PRI)
id a unique thread id

Member Function Documentation

void Thread::kill  

The thread is removed and cannot be used anymore

void Thread::ready  

Sets the status of the thread to READY, i.e. it is scheduled for execution

void Thread::reschedule   [protected]

Tells the scheduler to choose another thread for execution

void Thread::run   [static, protected]

The method is overwritten by the inheritor. When the thread starts the code in this run method is executed

Reimplemented in Commander, SIR, and UI.

void Thread::sleep int    hundrethSeconds [protected]

Let the thread sleep for at least n hundreth seconds


bool Thread::spawn  

The thread is initialized and inserted in scheduler queue but not set to READY yet

true if spawn was successful
See also:

Reimplemented in Commander, SIR, and UI.

void Thread::suspend  

The status of the thread is set to SUSPENDED. It will not be scheduled for execution anymore until it is set to READY again

See also:

Member Data Documentation

int Thread::id [protected]

char* Thread::name [protected]

int Thread::priority [protected]

int Thread::stackSize [protected]

tcb* Thread::threadControlBlock [protected]

Thread control blocks are used by the RoBIOS library to manage threads. This Thread class handles the thread control block internally thus hiding complexity from the user

Generated on Mon Aug 26 18:34:10 2002 for Cube Clustering by doxygen1.3-rc3