ui-utilcpp 1.10.3
Public Types | Public Member Functions
UI::Util::MutexLock< Mutex > Class Template Reference

Mutex Lock class; an object of this class will guard a scope. More...

#include <Misc.hpp>

Collaboration diagram for UI::Util::MutexLock< Mutex >:
Collaboration graph

Public Types

enum  ErrorCode { Locked_ = 1 }
 Error codes for exceptions.
 
typedef CodeException< ErrorCodeException
 This classes exceptions.
 

Public Member Functions

 MutexLock (Mutex &mutex, bool wait=true)
 Constructor; locks the mutex.
 
 ~MutexLock ()
 Destructor; unlocks the mutex.
 

Detailed Description

template<typename Mutex>
class UI::Util::MutexLock< Mutex >

Mutex Lock class; an object of this class will guard a scope.

The Mutex class must provide enterMutex(), tryEnterMutex() and leaveMutex() methods.

Examples
EchoServer.cpp, FileLock.cpp, and Regex.cpp.

Constructor & Destructor Documentation

◆ MutexLock()

template<typename Mutex >
UI::Util::MutexLock< Mutex >::MutexLock ( Mutex mutex,
bool  wait = true 
)
inline

Constructor; locks the mutex.

Parameters
mutexAny Mutex providing enterMutex(), tryEnterMutex() and leaveMutex().
waitWhether to wait until the lock can be set, or to return with exception LOCKED.

References UI_THROW_CODE.


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