6 #ifndef KAGOME_SAFE_OBJECT_HPP 7 #define KAGOME_SAFE_OBJECT_HPP 10 #include <shared_mutex> 37 template <
typename T,
typename M = std::shared_mutex>
39 template <
typename... Args>
44 std::unique_lock lock(
cs_);
45 return std::forward<F>(f)(
t_);
50 std::shared_lock lock(
cs_);
51 return std::forward<F>(f)(
t_);
59 #endif // KAGOME_SAFE_OBJECT_HPP SafeObject(Args &&...args)
auto sharedAccess(F &&f) const
auto exclusiveAccess(F &&f)