NvConditionVariable Class Reference

Abstract class that represents a condition variable instance. More...

#include <NvThread.h>

List of all members.

Public Types

enum  NvConditionVariableStatus { NvConditionVariableStatus_Timeout = 0, NvConditionVariableStatus_NoTimeout = 1 }
 Enumeration returned by the timedWaitConditionVariable method. More...

Public Member Functions

 NvConditionVariable (void)
 Default constructor Only constructor that creates an instance of a condition variable.
 NvConditionVariable (const NvConditionVariable &obj)
 Copy constructor Do NOT use.
virtual ~NvConditionVariable (void)
 Destructor.
Conditon variable API pure virtual methods
To be overridden with platform specific calls by the implementing derived classes.

virtual void signalConditionVariable (void)=0
 Notify one thread waiting on the condition variable.
virtual void broadcastConditionVariable (void)=0
 Notify all threads waiting on the condition variable.
virtual void waitConditionVariable (NvMutex *mutex)=0
 Make the thread wait until the mutex is available.
virtual NvConditionVariableStatus timedWaitConditionVariable (NvMutex *mutex, long long int timeout)=0
 Make the thread wait until the mutex is available for a fixed amount of time.


Detailed Description

Abstract class that represents a condition variable instance.

Designed to be a wrapper with an almost direct mapping between the condition-variable-related APIs in the nn::os namespace. It should be derived and implemented according to platform specifications.


Member Enumeration Documentation

Enumeration returned by the timedWaitConditionVariable method.

Used for indicating whether a timed wait on a condition variable exited due to a timeout or a successful mutex lock.


Constructor & Destructor Documentation

NvConditionVariable::NvConditionVariable ( void   )  [inline]

Default constructor Only constructor that creates an instance of a condition variable.

NvConditionVariable::NvConditionVariable ( const NvConditionVariable 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 void NvConditionVariable::broadcastConditionVariable ( void   )  [pure virtual]

Notify all threads waiting on the condition variable.

Usually used to dispatch work to other threads after placing it in a queue (monitor paradigm).

virtual void NvConditionVariable::signalConditionVariable ( void   )  [pure virtual]

Notify one thread waiting on the condition variable.

Usually used to dispatch work to other threads after placing it in a queue (monitor paradigm).

virtual NvConditionVariableStatus NvConditionVariable::timedWaitConditionVariable ( NvMutex mutex,
long long int  timeout 
) [pure virtual]

Make the thread wait until the mutex is available for a fixed amount of time.

It will also unlock the mutex while the thread sleeps, and it will reacquire it once it wakes up to check on the condition again.

Parameters:
[in] mutex the mutex associated with the condition variable.
[in] timeout requested waiting time in nanoseconds.
Returns:
the NvConditionVariableStatus enumeration signaling whether the timed wait on a condition variable exited due to a timeout or a successful mutex lock.

virtual void NvConditionVariable::waitConditionVariable ( NvMutex mutex  )  [pure virtual]

Make the thread wait until the mutex is available.

It will also unlock the mutex while the thread sleeps, and it will reacquire it once it wakes up to check on the condition again.

Parameters:
[in] mutex the mutex associated with the condition variable.


The documentation for this class was generated from the following file: