LLScopedLock Class Reference

Small class to help lock and unlock mutexes. More...

#include <llapr.h>

List of all members.

Public Member Functions

 LLScopedLock (apr_thread_mutex_t *mutex)
 Constructor which accepts a mutex, and locks it.
 ~LLScopedLock ()
 Destructor which unlocks the mutex if still locked.
bool isLocked () const
 Check lock.
void unlock ()
 This method unlocks the mutex.

Protected Attributes

bool mLocked
apr_thread_mutex_t * mMutex


Detailed Description

Small class to help lock and unlock mutexes.

This class is used to have a stack level lock once you already have an apr mutex handy. The constructor handles the lock, and the destructor handles the unlock. Instances of this class are not thread safe.

Definition at line 72 of file llapr.h.


Constructor & Destructor Documentation

LLScopedLock::LLScopedLock ( apr_thread_mutex_t *  mutex  ) 

Constructor which accepts a mutex, and locks it.

Parameters:
mutex An allocated APR mutex. If you pass in NULL, this wrapper will not lock.

Definition at line 78 of file llapr.cpp.

References ll_apr_warn_status(), mLocked, and mMutex.

LLScopedLock::~LLScopedLock (  ) 

Destructor which unlocks the mutex if still locked.

Definition at line 97 of file llapr.cpp.

References unlock().


Member Function Documentation

bool LLScopedLock::isLocked (  )  const [inline]

Check lock.

Definition at line 91 of file llapr.h.

References mLocked.

void LLScopedLock::unlock (  ) 

This method unlocks the mutex.

Definition at line 102 of file llapr.cpp.

References ll_apr_warn_status(), mLocked, and mMutex.

Referenced by ~LLScopedLock().


Member Data Documentation

bool LLScopedLock::mLocked [protected]

Definition at line 99 of file llapr.h.

Referenced by isLocked(), LLScopedLock(), and unlock().

apr_thread_mutex_t* LLScopedLock::mMutex [protected]

Definition at line 100 of file llapr.h.

Referenced by LLScopedLock(), and unlock().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:42 2010 for Second Life Viewer by  doxygen 1.4.7