NvThread Class Reference
Abstract class that represents a thread instance. More...
#include <NvThread.h>
Public Member Functions | |
NvThread (void) | |
Default constructor Do NOT use. | |
NvThread (const NvThread &obj) | |
Copy constructor Do NOT use. | |
NvThread (NvThreadFunction function, void *argument, void *stack, size_t stackSize, int priority) | |
Constructor Only constructor that creates an instance of a thread. | |
virtual | ~NvThread (void) |
Destructor. | |
Threading API pure virtual methods | |
To be overridden with platform specific calls by the implementing derived classes. | |
virtual void | startThread (void)=0 |
Start thread execution. | |
virtual void | waitThread (void)=0 |
Wait for thread completion. | |
virtual int | changeThreadPriority (int priority)=0 |
Changes the priority of the thread. | |
virtual int | getThreadPriority (void) const =0 |
Gets the original priority of the thread. | |
virtual int | getThreadCurrentPriority (void) const =0 |
Gets the current priority of the thread. | |
virtual void | setThreadName (const char *name)=0 |
Sets the name of the thread. | |
virtual void | setThreadNamePointer (const char *name)=0 |
Sets the name of the thread. | |
virtual const char * | getThreadNamePointer (void) const =0 |
Gets the name of the thread. | |
Static Public Attributes | |
Threading API constants | |
These should match the corresponding constants defined in the nn::os namespace. | |
static const int | ThreadNameLengthMax = 32 |
Maximum thread name length (in number of characters). | |
static const int | ThreadPriorityRangeSize = 32 |
Size of integer range for thread priority values. | |
static const int | HighestThreadPriority = 0 |
Upper boundary for thread priority value integer range. | |
static const int | DefaultThreadPriority = (ThreadPriorityRangeSize / 2) |
Suggested default value for thread priority assignment; intended to be near the mid-range point. | |
static const int | LowestThreadPriority = (ThreadPriorityRangeSize - 1) |
Lower boundary for thread priority value integer range. | |
static const int | StackRegionAlignment = 4096 |
Size of memory block for thread stack alignment purposes. |
Detailed Description
Abstract class that represents a thread instance.Designed to be a wrapper with an almost direct mapping between the thread-related APIs in the nn::os namespace. It should be derived and implemented according to platform specifications.
Constructor & Destructor Documentation
NvThread::NvThread | ( | void | ) | [inline] |
Default constructor Do NOT use.
Overwritten for safety; it should trigger an assert or exception.
NvThread::NvThread | ( | const NvThread & | obj | ) | [inline] |
Copy constructor Do NOT use.
Overwritten for safety; it should trigger an assert or exception.
- Parameters:
-
[in] obj reference to instance in attempted copy
NvThread::NvThread | ( | NvThreadFunction | function, | |
void * | argument, | |||
void * | stack, | |||
size_t | stackSize, | |||
int | priority | |||
) | [inline] |
Constructor Only constructor that creates an instance of a thread.
- Parameters:
-
[in] function the function pointer the thread should execute. [in] argument data structure with arguments to the function. [in] stack pointer to allocated stack memory for the thread. [in] stackSize size of allocated stack memory for the thread. It must be aligned with the NVTHREAD_STACK_ALIGN attribute declaration. [in] priority priority assigned to the thread; integer value between HighestThreadPriority and LowestThreadPriority.
Member Function Documentation
virtual int NvThread::changeThreadPriority | ( | int | priority | ) | [pure virtual] |
Changes the priority of the thread.
Changes the priority of the subject thread.
- Parameters:
-
[in] priority priority assigned to the thread; integer value between HighestThreadPriority and LowestThreadPriority.
- Returns:
- the previous priority value before the change.
virtual int NvThread::getThreadCurrentPriority | ( | void | ) | const [pure virtual] |
Gets the current priority of the thread.
Gets the current priority of the subject thread as determined by the last call to changeThreadPriority, if any; otherwise, as determined by the constructor call.
- Returns:
- the current priority value.
virtual const char* NvThread::getThreadNamePointer | ( | void | ) | const [pure virtual] |
Gets the name of the thread.
Gets a pointer to character string with the name of the thread; useful for debugging purposes. Do NOT modify the string.
- Returns:
- pointer to the character string with the name.
virtual int NvThread::getThreadPriority | ( | void | ) | const [pure virtual] |
Gets the original priority of the thread.
Gets the priority of the subject thread as assigned at its creation (constructor call).
- Returns:
- the original priority value.
virtual void NvThread::setThreadName | ( | const char * | name | ) | [pure virtual] |
Sets the name of the thread.
Sets the name of the thread; useful for debugging purposes. The pointer to the character string DOES NOT need to be kept for the thread to use.
- Parameters:
-
[in] name character string with the name.
virtual void NvThread::setThreadNamePointer | ( | const char * | name | ) | [pure virtual] |
Sets the name of the thread.
Sets the name of the thread; useful for debugging purposes. The pointer to the character string DOES need to be kept for the thread to use.
- Parameters:
-
[in] name character string with the name.
virtual void NvThread::startThread | ( | void | ) | [pure virtual] |
Start thread execution.
Starts execution of the assigned function for the subject thread.
virtual void NvThread::waitThread | ( | void | ) | [pure virtual] |
Wait for thread completion.
Blocks the currently executing thread until the subject thread finishes execution of its assigned function.
Member Data Documentation
const int NvThread::DefaultThreadPriority = (ThreadPriorityRangeSize / 2) [static] |
Suggested default value for thread priority assignment; intended to be near the mid-range point.
const int NvThread::HighestThreadPriority = 0 [static] |
Upper boundary for thread priority value integer range.
(Notice the sequence of values is inverse with respect to the priority)
const int NvThread::LowestThreadPriority = (ThreadPriorityRangeSize - 1) [static] |
Lower boundary for thread priority value integer range.
(Notice the sequence of values is inverse with respect to the priority)
The documentation for this class was generated from the following file: