|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
RAII-style wrapper for POSIX mutexes. More...
#include <pthread.h>#include <errno.h>#include <ahDefs.H>#include <ahUtils.H>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | UseMutex |
| RAII-style mutex lock guard. More... | |
Macros | |
| #define | CTOR_USE_MUTEX(name, mutex) name(mutex) |
| For member initializer lists. | |
| #define | CTOR_INH_USE_MUTEX(mutex) UseMutex(mutex) |
| For base class initialization in derived classes. | |
| #define | USE_MUTEX(name, mutex) UseMutex name(mutex) |
| Declare a named UseMutex guard. | |
| #define | CRITICAL_SECTION(mutex) UseMutex critical_section(mutex) |
| Create an anonymous critical section guard. | |
Functions | |
| void | init_mutex (pthread_mutex_t *) |
| Initialize a pthread mutex (pointer version) | |
| void | init_mutex (pthread_mutex_t &) |
| Initialize a pthread mutex (reference version) | |
| void | destroy_mutex (pthread_mutex_t *) |
| Destroy a pthread mutex (pointer version) | |
| void | destroy_mutex (pthread_mutex_t &) |
| Destroy a pthread mutex (reference version) | |
RAII-style wrapper for POSIX mutexes.
This file provides utilities for working with POSIX mutexes in a C++ RAII style, ensuring automatic lock release and simplifying critical section management.
UseMutex: Main RAII lock guard classinit_mutex(): Initialize a pthread mutexdestroy_mutex(): Destroy a pthread mutexUSE_MUTEX(name, mutex): Declare a named lock guardCRITICAL_SECTION(mutex): Create an anonymous critical sectionCTOR_USE_MUTEX(name, mutex): For member initializer listsCTOR_INH_USE_MUTEX(mutex): For base class initializationDefinition in file useMutex.H.
| #define CRITICAL_SECTION | ( | mutex | ) | UseMutex critical_section(mutex) |
Create an anonymous critical section guard.
Definition at line 233 of file useMutex.H.
| #define CTOR_INH_USE_MUTEX | ( | mutex | ) | UseMutex(mutex) |
For base class initialization in derived classes.
Definition at line 225 of file useMutex.H.
| #define CTOR_USE_MUTEX | ( | name, | |
| mutex | |||
| ) | name(mutex) |
For member initializer lists.
Definition at line 221 of file useMutex.H.
| #define USE_MUTEX | ( | name, | |
| mutex | |||
| ) | UseMutex name(mutex) |
Declare a named UseMutex guard.
Definition at line 229 of file useMutex.H.
|
extern |
Destroy a pthread mutex (reference version)
Definition at line 62 of file useMutex.C.
References destroy_mutex().
|
extern |
Destroy a pthread mutex (pointer version)
Definition at line 54 of file useMutex.C.
References ah_domain_error_if, Aleph::maps(), and Aleph::to_string().
Referenced by Log_Manager::~Log_Manager(), and destroy_mutex().
|
extern |
Initialize a pthread mutex (reference version)
Definition at line 49 of file useMutex.C.
References init_mutex().
|
extern |
Initialize a pthread mutex (pointer version)
Definition at line 41 of file useMutex.C.
References ah_domain_error_if, Aleph::maps(), and Aleph::to_string().
Referenced by Log_Manager::Log_Manager(), and init_mutex().