Take a Mutex reference 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.
Public Member Functions | |
ScopedMutexTryLock (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. | |
~ScopedMutexTryLock () | |
Unlock the mutex (if we hold the lock). | |
bool | hasLock () |
Take a Mutex reference 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.
Definition at line 177 of file Mutex.h.
atscppapi::ScopedMutexTryLock::ScopedMutexTryLock | ( | 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.
mutex | a shared pointer to a Mutex. |
Definition at line 183 of file Mutex.h.
References atscppapi::Mutex::tryLock().
atscppapi::ScopedMutexTryLock::~ScopedMutexTryLock | ( | ) | [inline] |
Unlock the mutex (if we hold the lock).
Definition at line 191 of file Mutex.h.
References atscppapi::Mutex::unlock().
bool atscppapi::ScopedMutexTryLock::hasLock | ( | ) | [inline] |