|
| mutex () |
| Default constructor. More...
|
|
| ~mutex ()=default |
| Defaulted destructor.
|
|
void | lock () |
| Locks the mutex, blocks if already locked. More...
|
|
bool | try_lock () |
| Tries to lock the mutex, returns regardless if the lock succeeds. More...
|
|
void | unlock () |
| Unlocks a previously locked mutex. More...
|
|
native_handle_type | native_handle () noexcept |
| Access a native handle to this condition variable. More...
|
|
enum pobj_tx_param | lock_type () const noexcept |
| The type of lock needed for the transaction API. More...
|
|
mutex & | operator= (const mutex &)=delete |
| Deleted assignment operator.
|
|
| mutex (const mutex &)=delete |
| Deleted copy constructor.
|
|
Persistent memory resident mutex implementation.
This class is an implementation of a PMEM-resident mutex which mimics in behavior the C++11 std::mutex. This class satisfies all requirements of the Mutex and StandardLayoutType concepts. The typical usage example would be:
#include <mutex>
namespace nvobj = pmem::obj;
void
unique_guard_example()
{
struct root {
nvobj::mutex pmutex;
};
auto pop = nvobj::pool<root>::create("poolfile", "layout",
PMEMOBJ_MIN_POOL);
auto proot = pop.get_root();
std::lock_guard<nvobj::mutex> guard(proot->pmutex);
std::unique_lock<nvobj::mutex> other_guard(proot->pmutex);
}
Persistent smart pointer.