NvThreadManager Class Reference
Abstract class used to create, destroy and manage the threading API's data structures. More...
#include <NvThread.h>
Public Member Functions | |
NvThreadManager (void) | |
Default constructor. | |
NvThreadManager (const NvThreadManager &obj) | |
Copy constructor Do NOT use. | |
virtual | ~NvThreadManager (void) |
Destructor. | |
#NvThread related methods. | |
Used to handle creation, destruction and other non-instance-related interactions with NvThread instances. | |
virtual NvThread * | createThread (NvThreadFunction function, void *argument, void *stack, size_t stackSize, int priority)=0 |
Create an instance of a thread. | |
virtual void | destroyThread (NvThread *thread)=0 |
Destroys an instance of a thread. | |
virtual void | yieldThread (void)=0 |
Yields to a similarly prioritized thread. | |
virtual void | sleepThread (long long int time)=0 |
Sleep for a fixed amount of time. | |
virtual NvThread * | getCurrentThread (void) const =0 |
Gets the currently executing thread. | |
virtual int | getCurrentProcessorNumber (void) const =0 |
Gets the current processor number. | |
#NvMutex related methods. | |
virtual NvMutex * | initializeMutex (const bool recursive, const int lockLevel) const =0 |
Create a new mutex instance. | |
virtual void | finalizeMutex (NvMutex *mutex) const =0 |
Destroy a mutex instance. | |
#NvConditionVariable related methods. | |
virtual NvConditionVariable * | initializeConditionVariable (void) const =0 |
Create a new condition variable instance. | |
virtual void | finalizeConditionVariable (NvConditionVariable *conditionVariable) const =0 |
Destroy a condition variable instance. |
Detailed Description
Abstract class used to create, destroy and manage the threading API's data structures.While derived classes should have similar functionality, their role is to create objects related to the platform-specific implementations of threads, mutexes and condition variables. A single instance of this class should exist for the application.
Constructor & Destructor Documentation
NvThreadManager::NvThreadManager | ( | void | ) | [inline] |
Default constructor.
Use it to create a singleton instance of the derived, implementing class.
NvThreadManager::NvThreadManager | ( | const NvThreadManager & | 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
Member Function Documentation
virtual NvThread* NvThreadManager::createThread | ( | NvThreadFunction | function, | |
void * | argument, | |||
void * | stack, | |||
size_t | stackSize, | |||
int | priority | |||
) | [pure virtual] |
Create an instance of a thread.
Used to facilitate constructor handling as well as tracking all NvThread objects by the application.
- 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.
- Returns:
- new thread instance.
virtual void NvThreadManager::destroyThread | ( | NvThread * | thread | ) | [pure virtual] |
Destroys an instance of a thread.
This ONLY works if the thread instance has created by calling the createThread method, as opposed to calling the NvThread constructor directly.
- Parameters:
-
[in] thread instance to be destroyed.
virtual void NvThreadManager::finalizeConditionVariable | ( | NvConditionVariable * | conditionVariable | ) | const [pure virtual] |
Destroy a condition variable instance.
- Parameters:
-
[in] condition variable instance to be destroyed.
virtual void NvThreadManager::finalizeMutex | ( | NvMutex * | mutex | ) | const [pure virtual] |
Destroy a mutex instance.
- Parameters:
-
[in] mutex instance to be destroyed.
virtual int NvThreadManager::getCurrentProcessorNumber | ( | void | ) | const [pure virtual] |
Gets the current processor number.
Queries and returns the processor number for the currently executing thread.
- Returns:
- the processor number.
virtual NvThread* NvThreadManager::getCurrentThread | ( | void | ) | const [pure virtual] |
Gets the currently executing thread.
This ONLY works if the thread instance has created by calling the createThread method, as opposed to calling the NvThread constructor directly.
- Returns:
- pointer to the current thread.
virtual NvConditionVariable* NvThreadManager::initializeConditionVariable | ( | void | ) | const [pure virtual] |
Create a new condition variable instance.
- Returns:
- pointer to the new condition variable instance.
virtual NvMutex* NvThreadManager::initializeMutex | ( | const bool | recursive, | |
const int | lockLevel | |||
) | const [pure virtual] |
Create a new mutex instance.
Mutexes can be recursive (i.e. they allows the same thread to acquire multiple levels of ownership over the same mutex) or not.
- Parameters:
-
[in] recursive flag that determines if the mutex is recursive [in] lockLevel maximum number of ownership levels allowed for the mutex and the same thread.
- Returns:
- pointer to the new mutex instance.
virtual void NvThreadManager::sleepThread | ( | long long int | time | ) | [pure virtual] |
Sleep for a fixed amount of time.
Pauses execution of the currently executing thread for a fixed amount of time.
- Parameters:
-
[in] time sleep time in nanoseconds.
virtual void NvThreadManager::yieldThread | ( | void | ) | [pure virtual] |
Yields to a similarly prioritized thread.
Cedes the execution opportunity of the currently executing thread to another of similar priority.
The documentation for this class was generated from the following file: