Class for enabling a Mutex within a specific program scope which will unlock the mutex when out of scope (when object is destroyed). More...
#include <mutex.h>
Public Member Functions | |
ScopedLock (const Mutex *mutex) | |
Constructor. This initializes a ScopedLock by locking the mutex. Once the ScopedLock object goes out of scope (or is deleted), the Mutex is automatically unlocked by the destructor. | |
~ScopedLock () | |
Destructor. On destruction, the Mutex is unlocked automatically. |
Class for enabling a Mutex within a specific program scope which will unlock the mutex when out of scope (when object is destroyed).
The ScopedLock mutex is designed to prevent deadlocks. It will only lock the provided mutex in the current thread if it hasn't been locked yet, and will only unlock if the ScopedLock instanced called lock. Unlock is done when the object goes out of scope or is deleted.
Definition at line 330 of file mutex.h.
Mutex::ScopedLock::ScopedLock | ( | const Mutex * | mutex ) |
Constructor. This initializes a ScopedLock by locking the mutex. Once the ScopedLock object goes out of scope (or is deleted), the Mutex is automatically unlocked by the destructor.
[in] | mutex | Pointer to Mutex to lock within a specific scope. |
Mutex::ScopedLock::~ScopedLock | ( | ) |