Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Mutex Class Reference

A standard mutex, or mutual exclusion lock. More...

#include <pmutex.h>

List of all members.

Public Member Functions

 Mutex ()
 ~Mutex ()
void lock () const
 Grabs the mutex if it is available.

void release () const
 Releases the mutex.


Private Member Functions

 Mutex (const Mutex &copy)
 Do not attempt to copy mutexes.

void operator= (const Mutex &copy)
 Do not attempt to copy mutexes.


Private Attributes

MutexImpl _impl

Friends

class ConditionVar


Detailed Description

A standard mutex, or mutual exclusion lock.

Only one thread can hold ("lock") a mutex at any given time; other threads trying to grab the mutex will block until the holding thread releases it.

Definition at line 42 of file pmutex.h.


Constructor & Destructor Documentation

Mutex::Mutex  )  [inline]
 

Definition at line 31 of file pmutex.I.

References INLINE.

Mutex::~Mutex  )  [inline]
 

Definition at line 42 of file pmutex.I.

References INLINE, and nassertv.

Mutex::Mutex const Mutex &  copy  )  [inline, private]
 

Do not attempt to copy mutexes.

Definition at line 54 of file pmutex.I.

References nassertv.


Member Function Documentation

void Mutex::lock  )  const [inline]
 

Grabs the mutex if it is available.

If it is not available, blocks until it becomes available, then grabs it. In either case, the function does not return until the mutex is held; you should then call unlock().

This method is considered const so that you can lock and unlock const mutexes, mainly to allow thread-safe access to otherwise const data.

Also see MutexHolder.

Definition at line 100 of file pmutex.I.

Referenced by GraphicsEngine::cull_and_draw_together().

void Mutex::operator= const Mutex &  copy  )  [inline, private]
 

Do not attempt to copy mutexes.

Definition at line 67 of file pmutex.I.

References _impl, and INLINE.

void Mutex::release  )  const [inline]
 

Releases the mutex.

It is an error to call this if the mutex was not already locked.

This method is considered const so that you can lock and unlock const mutexes, mainly to allow thread-safe access to otherwise const data.

Definition at line 123 of file pmutex.I.

Referenced by GraphicsEngine::cull_and_draw_together().


Friends And Related Function Documentation

friend class ConditionVar [friend]
 

Definition at line 56 of file pmutex.h.


Member Data Documentation

MutexImpl Mutex::_impl [private]
 

Definition at line 55 of file pmutex.h.

Referenced by operator=().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:52:29 2003 for Panda by doxygen1.3