8template <
typename ProtectedDataType,
typename MutextType>
18template <
typename ProtectedDataType,
template <
typename...>
typename LockType,
typename MutexType>
20 LockType<MutexType> lock_;
21 ProtectedDataType& data_;
25 ProtectedDataType
const&
37 ProtectedDataType
const&
49 ProtectedDataType
const*
61 operator LockType<MutexType>&()
68 friend class Mutex<std::remove_const_t<ProtectedDataType>, MutexType>;
70 Lock(MutexType& mutex, ProtectedDataType& data) : lock_(mutex), data_(data)
81template <
typename ProtectedDataType,
typename MutexType = std::mutex>
83 mutable MutexType mutex_;
84 ProtectedDataType data_;
105 template <
typename... Args>
109 return Mutex{ProtectedDataType{std::forward<Args>(args)...}};
118 template <
template <
typename...>
typename LockType = std::lock_guard>
122 return {mutex_, data_};
131 template <
template <
typename...>
typename LockType = std::lock_guard>
135 return {mutex_, data_};
A lock on a mutex that provides access to the protected data.
Definition Mutex.hpp:19
A container for data that is protected by a mutex. Inspired by Mutex in Rust.
Definition Mutex.hpp:82
Lock< ProtectedDataType, LockType, MutexType > lock()
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:133
static Mutex make(Args &&... args)
Make a new Mutex object with the given data.
Definition Mutex.hpp:107
Mutex(ProtectedDataType data)
Construct a new Mutex object with the given data.
Definition Mutex.hpp:94
Lock< ProtectedDataType const, LockType, MutexType > lock() const
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:120
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:56
This namespace contains various utilities.
Definition AccountUtils.hpp:11