17#ifndef MIR_SYNCHRONISED_H_
18#define MIR_SYNCHRONISED_H_
39 : value{
std::move(initial_value)}
60 lock{std::move(from.lock)}
94 template<
typename Cv,
typename Predicate>
95 void wait(Cv& cv, Predicate stop_waiting)
97 cv.wait(lock, stop_waiting);
102 LockedImpl(std::unique_lock<std::mutex>&& lock, U& value)
104 lock{
std::move(lock)}
109 std::unique_lock<std::mutex> lock;
156 std::mutex
mutable mutex;
Smart-pointer-esque accessor for the protected data.
Definition synchronised.h:56
void wait(Cv &cv, Predicate stop_waiting)
Allows waiting for a condition variable.
Definition synchronised.h:95
LockedImpl(LockedImpl &&from) noexcept
Definition synchronised.h:58
void drop()
Relinquish access to the data.
Definition synchronised.h:83
auto operator->() const -> U *
Definition synchronised.h:72
auto operator*() const -> U &
Definition synchronised.h:67
An object that enforces unique access to the data it contains.
Definition synchronised.h:35
auto lock() const -> LockedView
Lock the data and return an accessor.
Definition synchronised.h:151
Synchronised(T &&initial_value)
Definition synchronised.h:38
Synchronised & operator=(Synchronised const &)=delete
auto lock() -> Locked
Lock the data and return an accessor.
Definition synchronised.h:128
Synchronised(Synchronised const &)=delete
Definition splash_session.h:22