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

This is a standard, non-reentrant mutex, similar to the Mutex class. More...

#include "lightMutex.h"

Inheritance diagram for LightMutex:
LightMutexDirect

Public Member Functions

 LightMutex (const char *name)
 
 LightMutex (const std::string &name)
 
 LightMutex (const LightMutex &copy)=delete
 
LightMutexoperator= (const LightMutex &copy)=delete
 
- Public Member Functions inherited from LightMutexDirect
void acquire () const
 Grabs the lightMutex if it is available. More...
 
void clear_name ()
 The lightMutex name is only defined when compiling in DEBUG_THREADS mode. More...
 
bool debug_is_locked () const
 Returns true if the current thread has locked the LightMutex, false otherwise. More...
 
std::string get_name () const
 The lightMutex name is only defined when compiling in DEBUG_THREADS mode. More...
 
bool has_name () const
 The lightMutex name is only defined when compiling in DEBUG_THREADS mode. More...
 
void lock ()
 Alias for acquire() to match C++11 semantics. More...
 
void output (std::ostream &out) const
 This method is declared virtual in LightMutexDebug, but non-virtual in LightMutexDirect. More...
 
void release () const
 Releases the lightMutex. More...
 
void set_name (const std::string &name)
 The lightMutex name is only defined when compiling in DEBUG_THREADS mode. More...
 
bool try_lock ()
 Alias for try_acquire() to match C++11 semantics. More...
 
void unlock ()
 Alias for release() to match C++11 semantics. More...
 

Detailed Description

This is a standard, non-reentrant mutex, similar to the Mutex class.

It is different from Mutex in the case of SIMPLE_THREADS: in this case, the LightMutex class compiles to nothing; it performs no locking whatsoever. It is therefore useful only to protect very small sections of code, during which you are confident there will be no thread yields.

In the normal, system-threaded implementation, this class is exactly the same as Mutex.

ConditionVars cannot be used with LightMutex; they work only with Mutex.

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

Definition at line 39 of file lightMutex.h.


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