19 template<
class data_t,
class synchronization_primitive_t>
34 template<
class data_t,
class synchronization_primitive_t>
48 shared_proxy(data_t* pData, synchronization_primitive_t* pSynchronizationPrimitive,
bool bTryLock);
58 [[nodiscard]] data_t* operator->() noexcept;
59 [[nodiscard]]
const data_t* operator->()
const noexcept;
61 [[nodiscard]] data_t& operator*() noexcept;
62 [[nodiscard]]
const data_t& operator*()
const noexcept;
65 synchronization_primitive_t* m_pSynchronizationPrimitive =
nullptr;
66 data_t* m_pData =
nullptr;
80 template<
class data_t,
class synchronization_primitive_t = std::mutex>
92 class synchronization_primitive_raii
95 synchronization_primitive_raii();
96 ~synchronization_primitive_raii();
102 synchronization_primitive_t* get_object() noexcept;
105 synchronization_primitive_t sp;
118 template<
class... args_t>
139 [[nodiscard]] std::optional<proxy>
try_lock();
142 synchronization_primitive_raii m_SynchronizationPrimitiveRAII;
146 template<
class synchronization_primitive_t>
147 inline void lock_synchronization_primitive(synchronization_primitive_t* pSP)
152 template<
class synchronization_primitive_t>
153 inline void unlock_synchronization_primitive(synchronization_primitive_t* pSP)
158 template<
class synchronization_primitive_t>
159 inline bool try_lock_synchronization_primitive(synchronization_primitive_t* pSP)
161 return pSP->try_lock();
A proxy class that provides access to an object stored in threads_shared and provides raii for synchr...
A class that provides thread-safe access to an object, including construction and destruction.
proxy lock()
Wait for other threads to finish work with data object and retrieve proxy object.
std::optional< proxy > try_lock()
Try to lock synchronization primitive and get proxy.
threads_shared(args_t &&... args)
threads_shared object constructor
~threads_shared()
threads_shared object destructor