Public Member Functions

atscppapi::ScopedSharedMutexTryLock Class Reference

Take a shared_ptr to a Mutex and try to lock inside a scope and unlock when the scope is exited (if the lock was taken). More...

#include <Mutex.h>

Inherits atscppapi::noncopyable.

Collaboration diagram for atscppapi::ScopedSharedMutexTryLock:
Collaboration graph
[legend]

Public Member Functions

 ScopedSharedMutexTryLock (shared_ptr< Mutex > mutex)
 Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take the lock.
 ~ScopedSharedMutexTryLock ()
 Unlock the mutex (if we hold the lock).
bool hasLock ()

Detailed Description

Take a shared_ptr to a Mutex and try to lock inside a scope and unlock when the scope is exited (if the lock was taken).

This is an RAII implementation which will lock a mutex at the start of the scope and unlock it when the scope is exited if the lock was taken.

See also:
Mutex

Definition at line 216 of file Mutex.h.


Constructor & Destructor Documentation

atscppapi::ScopedSharedMutexTryLock::ScopedSharedMutexTryLock ( shared_ptr< Mutex mutex  )  [inline, explicit]

Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take the lock.

Parameters:
mutex a shared pointer to a Mutex.

Definition at line 222 of file Mutex.h.

atscppapi::ScopedSharedMutexTryLock::~ScopedSharedMutexTryLock (  )  [inline]

Unlock the mutex (if we hold the lock).

Definition at line 230 of file Mutex.h.


Member Function Documentation

bool atscppapi::ScopedSharedMutexTryLock::hasLock (  )  [inline]
Returns:
True if the lock was taken, False if it was not taken.

Definition at line 239 of file Mutex.h.


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