ERC CISST - cisst software

osaThread Class Reference
[OS Abstraction]

#include <osaThread.h>

Collaboration diagram for osaThread:

Collaboration graph
[legend]
List of all members.

Detailed Description

Define a thread object.

The thread class is just a wrapper on the OS-specific thread management functions. For now, wraps functions such as CreateThread, DeleteThread, GetThreadPriority, SetThreadPriority and so on. Additional functionality, such as inter-thread communication, maintenance of state information, etc., are provided by the mtsTask class.

See also:
mtsTask

Definition at line 156 of file osaThread.h.

Public Member Functions

Protected Member Functions

Friends


Constructor & Destructor Documentation

osaThread::osaThread (  ) 

Default constructor. Does nothing.

osaThread::~osaThread (  ) 

Default destructor. Does nothing.


Member Function Documentation

void osaThread::CreateInternal ( const char *  name,
void *  func,
void *  userdata,
bool  newThread = true 
) [protected]

Creates a new thread.

void osaThread::Create ( void *(*)(void)  threadStart,
const char *  name = 0,
int  priority = 0,
int  policy = 0 
) [inline]

Creates a new thread that will execute the specified function, with no parameters.

Parameters:
policy  No Scheduling Policy available in Windows

Definition at line 201 of file osaThread.h.

template<class _userDataType>
void osaThread::Create ( void *(*)(_userDataType)  threadStart,
_userDataType  userData = _userDataType(),
const char *  name = 0,
int  priority = 0,
int  policy = 0 
) [inline]

Creates a new thread that will execute the specified function, taking a single parameter.

Parameters:
policy  No Scheduling Policy available in Windows

Definition at line 211 of file osaThread.h.

template<class _entryType, class _userDataType>
void osaThread::Create ( _entryType *  obj,
void *(_entryType::*)(_userDataType)  threadStart,
_userDataType  userData = _userDataType(),
const char *  name = 0,
int  priority = 0,
int  policy = 0 
) [inline]

Creates a new thread that will execute the specified class member function. Note that the object is copied to the heap so it remains valid, even if the original object is destroyed.

Parameters:
policy  No Scheduling Policy available in Windows

Definition at line 224 of file osaThread.h.

void osaThread::CreateFromCurrentThread ( const char *  name = 0,
int  priority = 0,
int  policy = 0 
) [inline]

Initialize the thread object so that it refers to the calling thread, rather than creating a new thread. This allows existing threads to intermix with newly created threads.

Parameters:
policy  No Scheduling Policy available in Windows

Definition at line 240 of file osaThread.h.

void osaThread::Delete ( void   ) 

Deletes a thread. Deletes (removes from memory) everything associated with a thread, e.g. stack, local data, static variables.

void osaThread::Wait ( void   ) 

Wait for the thread to exit.

void osaThread::WaitForWakeup ( void   )  [inline]

Wait for thread to receive a "wakeup" signal/event.

Definition at line 258 of file osaThread.h.

void osaThread::WaitForWakeup ( double  timeoutInSec  )  [inline]

Wait for thread to receive a "wakeup" signal/event.

Definition at line 261 of file osaThread.h.

void osaThread::Wakeup ( void   )  [inline]

Signal the thread to wake up.

Definition at line 264 of file osaThread.h.

const char* osaThread::GetName ( void   )  const [inline]

Return the thread name.

Definition at line 267 of file osaThread.h.

osaThreadId osaThread::GetId ( void   )  const [inline]

Return the thread id.

Definition at line 270 of file osaThread.h.

PriorityType osaThread::GetPriority ( void   )  const

Get the OS *independent* priority of the thread.

void osaThread::SetPriority ( PriorityType  priority  ) 

Set the OS *independent* priority of the thread.

SchedulingPolicyType osaThread::GetSchedulingPolicy ( void   ) 

Get the OS *independent* scheduling policy of the thread. Will not be available on all platforms or will return a constant.

void osaThread::SetSchedulingPolicy ( SchedulingPolicyType  policy  ) 

Set the OS *independent* scheduling policy of the thread. Will not be available on all platforms.

void osaThread::Sleep ( double  timeInSeconds  ) 

Delay/suspend execution of the calling thread for the specified time. On some platforms, this method provides a better implementation of osaSleep, provided that it is called from the thread associated with this instance of the class. In this case, the Sleep will also be terminated by any call to Wakeup. If called from a different thread, it just calls osaSleep and is therefore not affected by any calls to Wakeup.

Parameters:
timeInSeconds The amount of time the task is suspended (in seconds)

bool osaThread::IsValid ( void   )  const [inline]

Returns whether the thread exists (is valid).

Definition at line 299 of file osaThread.h.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu