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*
80 operator LockType<MutexType>&()
87 friend class Mutex<std::remove_const_t<ProtectedDataType>, MutexType>;
89 Lock(MutexType& mutex, ProtectedDataType& data) : lock_(mutex), data_(data)
100template <
typename ProtectedDataType,
typename MutexType = std::mutex>
102 mutable MutexType mutex_;
103 ProtectedDataType data_;
124 template <
typename... Args>
128 return Mutex{ProtectedDataType{std::forward<Args>(args)...}};
137 template <
template <
typename...>
typename LockType = std::lock_guard>
141 return {mutex_, data_};
150 template <
template <
typename...>
typename LockType = std::lock_guard>
154 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:101
Lock< ProtectedDataType, LockType, MutexType > lock()
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:152
static Mutex make(Args &&... args)
Make a new Mutex object with the given data.
Definition Mutex.hpp:126
Mutex(ProtectedDataType data)
Construct a new Mutex object with the given data.
Definition Mutex.hpp:113
Lock< ProtectedDataType const, LockType, MutexType > lock() const
Lock the mutex and get a lock object allowing access to the protected data.
Definition Mutex.hpp:139
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70
This namespace contains various utilities.
Definition AccountUtils.hpp:30