Functions for locking/unlocking a mutex. More...
#include <Mutex.h>
Public Member Functions | |
| void | lock () |
| Lock the mutex. | |
| Mutex () | |
| Empty constructor (equivalent to Mutex(false) ) | |
| Mutex (bool recursive) | |
| Mutex (const Mutex &)=delete | |
| Copy constructor. | |
| Mutex & | operator= (const Mutex &)=delete |
| Assignment operator. | |
| bool | ownLock () const |
| Return true if we already own the lock. | |
| bool | tryLock () |
| Try to lock the mutex and return true if successful. | |
| void | unlock () |
| Unlock the mutex. | |
| ~Mutex ()=default | |
| Destructor. | |
Private Attributes | |
| volatile int | d_count |
| volatile int | d_id |
| std::mutex | d_mutex |
| bool | d_recursive |
Functions for locking/unlocking a mutex.
This class provides basic routines for creating, locking, and unlocking a mutex
The lock may be recursive, meaning that the same thread may lock and unlock the lock multiple times before releasing it. In this case unlock must be called the same number of times before another thread may lock the mutex.
| AMP::Mutex::Mutex | ( | ) |
Empty constructor (equivalent to Mutex(false) )
|
explicit |
Default constructor
| recursive | If set to true a thread may repeated lock a mutex. If set to false an attept to repeatedly lock will throw an error. |
|
default |
Destructor.
|
delete |
Copy constructor.
| void AMP::Mutex::lock | ( | ) |
Lock the mutex.
| bool AMP::Mutex::ownLock | ( | ) | const |
Return true if we already own the lock.
| bool AMP::Mutex::tryLock | ( | ) |
Try to lock the mutex and return true if successful.
| void AMP::Mutex::unlock | ( | ) |
Unlock the mutex.
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |