EPICS Base 7.0.8.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
epicsGuard< T > Class Template Reference

Provides an RAII style lock/unlock of a mutex. More...

#include <epicsGuard.h>

Public Types

typedef epicsGuardRelease< T > release_t
 

Public Member Functions

 epicsGuard (T &mutexIn)
 Guard a mutex based on scope.
 
void assertIdenticalMutex (const T &) const
 

Friends

class epicsGuardRelease< T >
 

Detailed Description

template<class T>
class epicsGuard< T >

Provides an RAII style lock/unlock of a mutex. When this object is created, it attempts to lock the mutex it was given. When control leaves the scope where this was created, the destructor unlocks the mutex.

This class is also useful in situations where C++ exceptions are possible.

Example

epicsMutex mutex;
{
epicsGuard guard(mutex);
printf("mutex is locked")
}
printf("mutex is unlocked\n");
Provides an RAII style lock/unlock of a mutex.
Definition epicsGuard.h:53
The C++ API for an epicsMutex.
Definition epicsMutex.h:69

Definition at line 53 of file epicsGuard.h.

Member Typedef Documentation

◆ release_t

template<class T >
typedef epicsGuardRelease<T> epicsGuard< T >::release_t

Definition at line 55 of file epicsGuard.h.

Constructor & Destructor Documentation

◆ epicsGuard()

template<class T >
epicsGuard< T >::epicsGuard ( T &  mutexIn)
inline

Constructs an epicsGuard, locking the mutex for the scope of this object.

Parameters
mutexInA mutex-like object to be lock()'ed and unlock()'ed

Definition at line 140 of file epicsGuard.h.

◆ ~epicsGuard()

template<class T >
epicsGuard< T >::~epicsGuard ( )
inline

Definition at line 147 of file epicsGuard.h.

Member Function Documentation

◆ assertIdenticalMutex()

template<class T >
void epicsGuard< T >::assertIdenticalMutex ( const T &  mutexToVerify) const
inline

Definition at line 153 of file epicsGuard.h.

Friends And Related Symbol Documentation

◆ epicsGuardRelease< T >

template<class T >
friend class epicsGuardRelease< T >
friend

Definition at line 70 of file epicsGuard.h.


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