Pthread lock for UG Framework. More...
#include <pthread.h>#include <iostream>Go to the source code of this file.
Classes | |
| struct | LockException |
| Exception that is thrown whenever something goes wrong with a lock. More... | |
| class | Lock |
| Class that implements a lock. The class wraps around pthread_mutex_t and adds some safeguards. More... | |
| class | LockRAII |
| Class to do RAII with a lock. The constructor will acquire the lock and the destructor will delete it. More... | |
| class | LockRAIIHelper |
| Same as LockRAII but with additional members to implement the LOCKED macro. More... | |
Namespaces | |
| namespace | UG |
Macros | |
| #define | LOCK_VERBOSE 0 |
| #define | LOCKED(lck) for (LockRAIIHelper raii_(lck,__FILE__, __LINE__); raii_; ++raii_) |
| #define | LOCK_RAII(lck) LockRAII raii_(lck, __FILE__, __LINE__) |
| #define LOCK_RAII | ( | lck | ) | LockRAII raii_(lck, __FILE__, __LINE__) |
Definition at line 295 of file paraPthLock.h.
| #define LOCK_VERBOSE 0 |
Definition at line 46 of file paraPthLock.h.
| #define LOCKED | ( | lck | ) | for (LockRAIIHelper raii_(lck,__FILE__, __LINE__); raii_; ++raii_) |
Macro to execute code that is guarded by a lock. Usage is like this: Lock l; LOCKED(&l) CODE where CODE is either a single statement or a block. The macro acquires l, executes CODE and then releases l. Acquisition and release of the lock are exception safe.
Definition at line 292 of file paraPthLock.h.