ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

ucommon::SharedProtocol::Locking Class Reference

#include <access.h>

Inheritance diagram for ucommon::SharedProtocol::Locking:
[legend]
Collaboration diagram for ucommon::SharedProtocol::Locking:
[legend]

Public Member Functions

 Locking (SharedProtocol *object)
 
 Locking (const Locking &copy)
 
Lockingoperator= (const Locking &copy)
 
 ~Locking ()
 
bool operator! () const
 
 operator bool () const
 
void release (void)
 
void exclusive (void)
 
void share (void)
 

Private Attributes

SharedProtocollock
 
int state
 
bool modify
 

Detailed Description

A kind of smart pointer object to support shared locking protocol. This object initiates a shared lock for the object being referenced when it is instantiated, and releases the shared lock when it is destroyed. You would pass the pointer an object that has the Shared as a base class.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 142 of file access.h.

Constructor & Destructor Documentation

◆ Locking() [1/2]

ucommon::SharedProtocol::Locking::Locking ( SharedProtocol object)

Create an instance of an exclusive object reference.

Parameters
objectcontaining Exclusive base class protocol to lock.

Definition at line 41 of file access.cpp.

References ucommon::SharedProtocol::_share(), lock, modify, and state.

◆ Locking() [2/2]

ucommon::SharedProtocol::Locking::Locking ( const Locking copy)

Definition at line 50 of file access.cpp.

References ucommon::copy().

◆ ~Locking()

ucommon::SharedProtocol::Locking::~Locking ( )

Destroy reference to shared locked object, release lock.

Definition at line 81 of file access.cpp.

Member Function Documentation

◆ exclusive()

void ucommon::SharedProtocol::Locking::exclusive ( void  )

Call exclusive access on referenced objects protocol.

Definition at line 119 of file access.cpp.

◆ operator bool()

ucommon::SharedProtocol::Locking::operator bool ( ) const
inline

Test if the reference holds an active lock.

Returns
true if locking an object.

Definition at line 177 of file access.h.

◆ operator!()

bool ucommon::SharedProtocol::Locking::operator! ( void  ) const
inline

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Definition at line 169 of file access.h.

◆ operator=()

SharedProtocol::Locking & ucommon::SharedProtocol::Locking::operator= ( const Locking copy)

Definition at line 61 of file access.cpp.

References ucommon::copy().

◆ release()

void ucommon::SharedProtocol::Locking::release ( void  )

Release a held lock programmatically. This can be used to de-reference the object being share locked without having to wait for the destructor to be called when the shared_lock falls out of scope.

Definition at line 100 of file access.cpp.

◆ share()

void ucommon::SharedProtocol::Locking::share ( void  )

Restore shared access on referenced objects protocol.

Definition at line 127 of file access.cpp.

Member Data Documentation

◆ lock

SharedProtocol* ucommon::SharedProtocol::Locking::lock
private

Definition at line 145 of file access.h.

Referenced by Locking().

◆ modify

bool ucommon::SharedProtocol::Locking::modify
private

Definition at line 147 of file access.h.

Referenced by Locking().

◆ state

int ucommon::SharedProtocol::Locking::state
private

Definition at line 146 of file access.h.

Referenced by Locking().


The documentation for this class was generated from the following files: