Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
Rapicorn::ScopedLock< MUTEX > Class Template Reference

The ScopedLock is a scope based lock ownership wrapper. More...

#include <thread.hh>

List of all members.

Public Member Functions

void lock ()
void unlock ()
 ScopedLock (MUTEX &mutex, struct AUTOMATIC_LOCK=AUTOMATIC_LOCK)
 ScopedLock (MUTEX &mutex, struct BALANCED_LOCK)

Detailed Description

template<class MUTEX>
class Rapicorn::ScopedLock< MUTEX >

The ScopedLock is a scope based lock ownership wrapper.

Placing a ScopedLock object on the stack conveniently ensures that its mutex will be automatically locked and properly unlocked when the scope is left, the current function returns or throws an exception. Mutex obbjects to be used by a ScopedLock need to provide the public methods lock() and unlock(). In AUTOMATIC_LOCK mode, the owned mutex is automatically locked upon construction and unlocked upon destruction. Intermediate calls to unlock() and lock() on the ScopedLock will be accounted for in the destructor. In BALANCED_LOCK mode, the lock is not automatically acquired upon construction, however the destructor will balance all intermediate unlock() and lock() calls. So this mode can be used to manage ownership for an already locked mutex.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines