5#include "webcface/common/webcface-config.h"
10#include <condition_variable>
15template <
typename Proxy,
typename Lock>
21 [[nodiscard]]
auto &
get() {
22 assert(this->owns_lock());
26 assert(this->owns_lock());
29 [[nodiscard]]
auto &
cond() {
return p->cond; }
52 mutable std::condition_variable cond;
55 template <
typename Proxy,
typename Lock>
69 mutable std::shared_mutex m;
72 template <
typename Proxy,
typename Lock>
76 std::unique_lock<std::shared_mutex>>
81 std::shared_lock<std::shared_mutex>>
RustのMutexのようにデータを保護するクラス
Definition mutex.h:49
ScopedLock< const MutexProxy, std::unique_lock< std::mutex > > const_lock() const
Definition mutex.h:62
ScopedLock< MutexProxy, std::unique_lock< std::mutex > > lock()
Definition mutex.h:58
auto * operator->()
Definition mutex.h:25
auto & cond()
Definition mutex.h:29
auto & get()
Definition mutex.h:21
ScopedLock(Proxy *p)
Definition mutex.h:20
ScopedLock< const SharedMutexProxy, std::shared_lock< std::shared_mutex > > shared_lock() const
Definition mutex.h:82
ScopedLock< SharedMutexProxy, std::unique_lock< std::shared_mutex > > lock()
Definition mutex.h:77
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117