Panda3D
Public Member Functions
MutexHolder Class Reference

A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a mutex. More...

#include "mutexHolder.h"

List of all members.

Public Member Functions

 MutexHolder (const Mutex &mutex)
 MutexHolder (const Mutex &mutex, Thread *current_thread)
 This variant on the constructor accepts the current thread as a parameter, if it is already known, as an optimization.
 MutexHolder (Mutex *&mutex)
 If the MutexHolder constructor is given a pointer to a Mutex object (instead of an actual object), it will first check to see if the pointer is NULL, and allocate a new Mutex if it is.

Detailed Description

A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a mutex.

It is a C++ convenience wrapper to call release() automatically when a block exits (for instance, on return).

Definition at line 29 of file mutexHolder.h.


Constructor & Destructor Documentation

MutexHolder::MutexHolder ( const Mutex mutex,
Thread current_thread 
) [inline]

This variant on the constructor accepts the current thread as a parameter, if it is already known, as an optimization.

Definition at line 37 of file mutexHolder.I.

References MutexDirect::acquire().

MutexHolder::MutexHolder ( Mutex *&  mutex) [inline]

If the MutexHolder constructor is given a pointer to a Mutex object (instead of an actual object), it will first check to see if the pointer is NULL, and allocate a new Mutex if it is.

This is intended as a convenience for functions that may need to reference a Mutex at static init time, when it is impossible to guarantee ordering of initializers.

Definition at line 60 of file mutexHolder.I.

References MutexDirect::acquire().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations