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::ExclusiveProtocol::Locking Class Reference

#include <access.h>

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

Public Member Functions

 Locking (ExclusiveProtocol *object)
 
 ~Locking ()
 
bool operator! () const
 
 operator bool () const
 
void release (void)
 

Private Member Functions

 __DELETE_COPY (Locking)
 

Private Attributes

ExclusiveProtocollock
 

Detailed Description

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

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

Definition at line 72 of file access.h.

Constructor & Destructor Documentation

◆ Locking()

ucommon::ExclusiveProtocol::Locking::Locking ( ExclusiveProtocol object)

Create an instance of an exclusive object reference.

Parameters
objectcontaining Exclusive base class protocol to lock.

Definition at line 74 of file access.cpp.

References ucommon::ExclusiveProtocol::_lock().

◆ ~Locking()

ucommon::ExclusiveProtocol::Locking::~Locking ( )

Destroy reference to exclusively locked object, release lock.

Definition at line 92 of file access.cpp.

Member Function Documentation

◆ __DELETE_COPY()

ucommon::ExclusiveProtocol::Locking::__DELETE_COPY ( Locking  )
private

◆ operator bool()

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

Test if the reference holds an active lock.

Returns
true if locking an object.

Definition at line 103 of file access.h.

◆ operator!()

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

Test if the reference holds an active lock.

Returns
true if is not locking an object.

Definition at line 95 of file access.h.

◆ release()

void ucommon::ExclusiveProtocol::Locking::release ( void  )

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

Definition at line 111 of file access.cpp.

Member Data Documentation

◆ lock

ExclusiveProtocol* ucommon::ExclusiveProtocol::Locking::lock
private

Definition at line 75 of file access.h.


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