25 #ifndef WSHAREDOBJECTTICKET_H
26 #define WSHAREDOBJECTTICKET_H
29 #include <shared_mutex>
32 #include "WCondition.h"
35 template <
typename T >
44 template <
typename Data >
81 WSharedObjectTicket( Data& data, std::shared_ptr< std::shared_mutex > mutex, std::shared_ptr< WCondition > condition ):
96 std::shared_ptr< std::shared_mutex >
m_mutex;
Class which represents granted access to a locked object.
void suppressUnlockCondition()
If called, the unlock will NOT fire the condition.
std::shared_ptr< WCondition > m_condition
A condition which gets notified after unlocking.
WSharedObjectTicket(Data &data, std::shared_ptr< std::shared_mutex > mutex, std::shared_ptr< WCondition > condition)
Create a new instance.
Data & m_data
The data to which access is allowed by the ticket.
std::shared_ptr< std::shared_mutex > m_mutex
The mutex used for locking.
virtual ~WSharedObjectTicket()
Destroys the ticket and releases the lock.
virtual void unlock()=0
Unlocks the mutex.
Wrapper around an object/type for thread safe sharing of objects among multiple threads.