25 #ifndef WSHAREDOBJECTTICKETREAD_H
26 #define WSHAREDOBJECTTICKETREAD_H
29 #include <shared_mutex>
32 #include "WCondition.h"
33 #include "WSharedObjectTicket.h"
39 template <
typename Data >
63 const Data&
get()
const
76 WSharedObjectTicketRead( Data& data, std::shared_ptr< std::shared_mutex > mutex, std::shared_ptr< WCondition > condition ):
78 m_lock( boost::shared_lock< std::shared_mutex >( *mutex ) )
85 boost::shared_lock< std::shared_mutex >
m_lock;
Class which represents granted access to a locked object.
WSharedObjectTicketRead(Data &data, std::shared_ptr< std::shared_mutex > mutex, std::shared_ptr< WCondition > condition)
Create a new instance.
virtual ~WSharedObjectTicketRead()
Destroys the ticket and releases the lock.
boost::shared_lock< std::shared_mutex > m_lock
The lock.
const Data & get() const
Returns the protected data.
virtual void unlock()
Unlocks the mutex.
Class which represents granted access to a locked object.
Wrapper around an object/type for thread safe sharing of objects among multiple threads.