Panda3D
Public Member Functions | List of all members
ConditionVar Class Reference

A condition variable, usually used to communicate information about changing state to a thread that is waiting for something to happen. More...

#include "conditionVar.h"

Inheritance diagram for ConditionVar:
ConditionVarDirect

Public Member Functions

 ConditionVar (Mutex &mutex)
 You must pass in a Mutex to the condition variable constructor. More...
 
 ConditionVar (const ConditionVar &copy)=delete
 
Mutexget_mutex () const
 Returns the mutex associated with this condition variable. More...
 
void notify_all ()=delete
 
ConditionVaroperator= (const ConditionVar &copy)=delete
 
- Public Member Functions inherited from ConditionVarDirect
 ConditionVarDirect (MutexDirect &mutex)
 You must pass in a Mutex to the condition variable constructor. More...
 
 ConditionVarDirect (const ConditionVarDirect &copy)=delete
 
MutexDirectget_mutex () const
 Returns the mutex associated with this condition variable. More...
 
void notify ()
 Informs one of the other threads who are currently blocked on wait() that the relevant condition has changed. More...
 
ConditionVarDirectoperator= (const ConditionVarDirect &copy)=delete
 
void output (std::ostream &out) const
 This method is declared virtual in ConditionVarDebug, but non-virtual in ConditionVarDirect. More...
 
void wait ()
 Waits on the condition. More...
 
void wait (double timeout)
 Waits on the condition, with a timeout. More...
 

Detailed Description

A condition variable, usually used to communicate information about changing state to a thread that is waiting for something to happen.

A condition variable can be used to "wake up" a thread when some arbitrary condition has changed.

The ConditionVar class does not support the full semantics of POSIX condition variables. In particular, it does not support the broadcast or notify_all function. See ConditionVarFull for a more complete (but possibly more expensive) API.

A condition variable is associated with a single mutex, and several condition variables may share the same mutex.

This class inherits its implementation either from ConditionVarDebug or ConditionVarDirect, depending on the definition of DEBUG_THREADS.

Definition at line 41 of file conditionVar.h.

Constructor & Destructor Documentation

◆ ConditionVar()

ConditionVar::ConditionVar ( Mutex mutex)
inlineexplicit

You must pass in a Mutex to the condition variable constructor.

This mutex may be shared by other condition variables, if desired. It is the caller's responsibility to ensure the Mutex object does not destruct during the lifetime of the condition variable.

Definition at line 21 of file conditionVar.I.

Member Function Documentation

◆ get_mutex()

Mutex & ConditionVar::get_mutex ( ) const
inline

Returns the mutex associated with this condition variable.

Definition at line 34 of file conditionVar.I.

References ConditionVarDirect::get_mutex().


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