OpenWalnut
1.2.5
|
Class which represents granted access to a locked object. More...
#include <WSharedObjectTicket.h>
Public Member Functions | |
virtual | ~WSharedObjectTicket () |
Destroys the ticket and releases the lock. | |
void | suppressUnlockCondition () |
If called, the unlock will NOT fire the condition. |
Protected Member Functions | |
WSharedObjectTicket (Data &data, boost::shared_ptr< boost::shared_mutex > mutex, boost::shared_ptr< WCondition > condition) | |
Create a new instance. | |
virtual void | unlock ()=0 |
Unlocks the mutex. |
Protected Attributes | |
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. | |
boost::shared_ptr< WCondition > | m_condition |
A condition which gets notified after unlocking. |
Friends | |
class | WSharedObject< Data > |
Class which represents granted access to a locked object.
It contains a reference to the object and a lock. The lock is freed after the ticket has been destroyed.
Definition at line 43 of file WSharedObjectTicket.h.
|
inlinevirtual |
Destroys the ticket and releases the lock.
Definition at line 52 of file WSharedObjectTicket.h.
References WSharedObjectTicket< Data >::m_condition.
|
inlineprotected |
Create a new instance.
It is protected to avoid someone to create them. It locks the mutex.
data | the data to protect |
mutex | the mutex used to lock |
condition | a condition that should be fired upon unlock. Can be NULL. |
Definition at line 79 of file WSharedObjectTicket.h.
|
inline |
If called, the unlock will NOT fire the condition.
This is useful in some situations if you find out "hey there actually was nothing changed".
Definition at line 65 of file WSharedObjectTicket.h.
References WSharedObjectTicket< Data >::m_condition.
|
protectedpure virtual |
Unlocks the mutex.
Implemented in WSharedObjectTicketRead< Data >, and WSharedObjectTicketWrite< Data >.
|
protected |
A condition which gets notified after unlocking.
Especially useful to notify waiting threads about a change in the object.
Definition at line 99 of file WSharedObjectTicket.h.
Referenced by WSharedObjectTicket< Data >::suppressUnlockCondition(), and WSharedObjectTicket< Data >::~WSharedObjectTicket().
|
protected |
The data to which access is allowed by the ticket.
Definition at line 84 of file WSharedObjectTicket.h.
|
protected |
The mutex used for locking.
Definition at line 94 of file WSharedObjectTicket.h.