OpenWalnut
1.2.5
|
Class which represents granted access to a locked object. More...
#include <WSharedObjectTicketWrite.h>
Public Member Functions | |
virtual | ~WSharedObjectTicketWrite () |
Destroys the ticket and releases the lock. | |
Data & | get () const |
Returns the protected data. | |
![]() | |
virtual | ~WSharedObjectTicket () |
Destroys the ticket and releases the lock. | |
void | suppressUnlockCondition () |
If called, the unlock will NOT fire the condition. |
Protected Member Functions | |
WSharedObjectTicketWrite (Data &data, boost::shared_ptr< boost::shared_mutex > mutex, boost::shared_ptr< WCondition > condition) | |
Create a new instance. | |
virtual void | unlock () |
Unlocks the mutex. | |
![]() | |
WSharedObjectTicket (Data &data, boost::shared_ptr< boost::shared_mutex > mutex, boost::shared_ptr< WCondition > condition) | |
Create a new instance. |
Protected Attributes | |
boost::unique_lock < boost::shared_mutex > | m_lock |
The lock. | |
![]() | |
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. This class especially implements the exclusive (write) lock.
Definition at line 38 of file WSharedObjectTicketWrite.h.
|
inlinevirtual |
Destroys the ticket and releases the lock.
Definition at line 47 of file WSharedObjectTicketWrite.h.
References WSharedObjectTicketWrite< Data >::unlock().
|
inlineprotected |
Create a new instance.
It is protected to avoid someone to create them. It locks the mutex for write.
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 72 of file WSharedObjectTicketWrite.h.
|
inline |
Returns the protected data.
As long as you own the ticket, you are allowed to use it.
Definition at line 58 of file WSharedObjectTicketWrite.h.
|
inlineprotectedvirtual |
Unlocks the mutex.
Implements WSharedObjectTicket< Data >.
Definition at line 86 of file WSharedObjectTicketWrite.h.
References WSharedObjectTicketWrite< Data >::m_lock.
Referenced by WSharedObjectTicketWrite< Data >::~WSharedObjectTicketWrite().
|
protected |
The lock.
Definition at line 76 of file WSharedObjectTicketWrite.h.
Referenced by WSharedObjectTicketWrite< Data >::unlock().