27template <
typename ProtectedDataType,
typename MutextType>
37template <
typename ProtectedDataType,
template <
typename...>
typename LockType,
typename MutexType>
39 LockType<MutexType> lock_;
40 ProtectedDataType& data_;
44 ProtectedDataType
const&
56 ProtectedDataType
const&
68 ProtectedDataType
const*
82 friend class Mutex<std::remove_const_t<ProtectedDataType>, MutexType>;
84 Lock(MutexType& mutex, ProtectedDataType& data) : lock_(mutex), data_(data)
95template <
typename ProtectedDataType,
typename MutexType = std::mutex>
97 mutable MutexType mutex_;
98 ProtectedDataType data_;
119 template <
typename... Args>
123 return Mutex{ProtectedDataType{std::forward<Args>(args)...}};
132 template <
template <
typename...>
typename LockType = std::lock_guard>
136 return {mutex_, data_};
145 template <
template <
typename...>
typename LockType = std::lock_guard>
149 return {mutex_, data_};
A lock on a mutex that provides access to the protected data.
Definition Mutex.hpp:38
A container for data that is protected by a mutex. Inspired by Mutex in Rust.
Definition Mutex.hpp:96
Lock< ProtectedDataType, LockType, MutexType > lock()
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:147
static Mutex make(Args &&... args)
Make a new Mutex object with the given data.
Definition Mutex.hpp:121
Mutex(ProtectedDataType data)
Construct a new Mutex object with the given data.
Definition Mutex.hpp:108
Lock< ProtectedDataType const, LockType, MutexType > lock() const
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:134
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70
This namespace contains various utilities.
Definition AccountUtils.hpp:30