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 >:

## Public Types

enum | ErrorCode { Locked_ = 1 }
| Error codes for exceptions.
typedef CodeException< ErrorCode > | Exception
| 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

  mutex | Any Mutex providing enterMutex(), tryEnterMutex() and leaveMutex().
  wait | Whether 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:

- Misc.hpp