MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
Mezzanine::Threading::ReadWriteLockGuard< T > Class Template Reference

ReadWrite lock guard. More...

#include <readwritespinlock.h>

Public Types

typedef T mutex_type
 This allows other code to use the type of this mutex in a more safe way.
 

Public Member Functions

 ReadWriteLockGuard (mutex_type &aMutex)
 The constructor locks the mutex. More...
 
 ~ReadWriteLockGuard ()
 The destructor unlocks the mutex.
 

Detailed Description

template<class T>
class Mezzanine::Threading::ReadWriteLockGuard< T >

ReadWrite lock guard.

The constructor locks the mutex, and the destructor unlocks the mutex, so the mutex will automatically be unlocked when the lock guard goes out of scope. Example usage:

ReadWriteSpinLock m;
int counter;
int Increment()
{
ReadWriteLockGuard<ReadWriteSpinLock> guard(m);
return counter++;
}

Definition at line 176 of file readwritespinlock.h.

Constructor & Destructor Documentation

template<class T >
Mezzanine::Threading::ReadWriteLockGuard< T >::ReadWriteLockGuard ( mutex_type aMutex)
inlineexplicit

The constructor locks the mutex.

Parameters
aMutexAny mutex which implements lock() and unlock().

Definition at line 190 of file readwritespinlock.h.


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