Spinning Topp Logo BlackTopp Studios
inc
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 180 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 194 of file readwritespinlock.h.


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