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