cisst-saw
|
Implementation of the Thread Proxy object in an OS independent manner. More...
#include <osaThreadBuddy.h>
Public Member Functions | |
osaThreadBuddy () | |
~osaThreadBuddy () | |
void | Create (const char *name, double period, int stack_size=1024 *256) |
void | Create (const char *name, const osaAbsoluteTime &tv, int stack_size=1024 *256) |
void | Delete () |
bool | IsPeriodic () const |
void | WaitForPeriod (void) |
void | WaitForRemainingPeriod (void) |
void | MakeHardRealTime (void) |
void | MakeSoftRealTime (void) |
void | Resume (void) |
void | Suspend (void) |
void | LockStack () |
void | UnlockStack () |
Implementation of the Thread Proxy object in an OS independent manner.
RTAI provides "buddy" or proxy objects so that any thread created using pthread can be made real time. Our rtsTask class uses this mechanism to provide real time abstract tasks that have a state and a mailbox. This class makes it possible to keep the rtsTask class free from OS dependent stuff, which is moved here. This would also make it easy to provide Soft Real Time tasks in Vanila Linux flavor.
osaThreadBuddy::osaThreadBuddy | ( | ) |
Constructor. Allocates internal data.
osaThreadBuddy::~osaThreadBuddy | ( | ) |
Destructor.
void osaThreadBuddy::Create | ( | const char * | name, |
double | period, | ||
int | stack_size = 1024 *256 |
||
) |
Create a thread buddy with a name 'name'
name | Name of thread buddy, the thread will also be referred using the same name. |
period | The period of the thread (in nanosecond) |
stack_size | The stack size allocated to the thread. A default value of 8Kb is used. |
void osaThreadBuddy::Create | ( | const char * | name, |
const osaAbsoluteTime & | tv, | ||
int | stack_size = 1024 *256 |
||
) |
void osaThreadBuddy::Delete | ( | ) |
Delete the thread buddy.
|
inline |
Return true if thread is periodic. Currently, returns true if the thread was created with a period > 0.
void osaThreadBuddy::LockStack | ( | ) |
Lock stack growth
void osaThreadBuddy::MakeHardRealTime | ( | void | ) |
Make a thread hard real time.
void osaThreadBuddy::MakeSoftRealTime | ( | void | ) |
Make a thread soft real time.
void osaThreadBuddy::Resume | ( | void | ) |
Resume execution of the thread.
void osaThreadBuddy::Suspend | ( | void | ) |
Suspend execution of the thread.
void osaThreadBuddy::UnlockStack | ( | ) |
Unlock stack
void osaThreadBuddy::WaitForPeriod | ( | void | ) |
Suspend the execution of the real time thread until the next period is reached.
void osaThreadBuddy::WaitForRemainingPeriod | ( | void | ) |
Suspend the execution of the real time thread for the remainder of the current period.