ucommon::exclusive_access Class Reference

A kind of smart pointer object to support exclusive locking protocol. More...

#include <access.h>

Collaboration diagram for ucommon::exclusive_access:

Collaboration graph
[legend]

Public Member Functions

 exclusive_access (ExclusiveAccess *object)
 Create an instance of an exclusive object reference.
 operator bool ()
 Test if the reference holds an active lock.
bool operator! ()
 Test if the reference holds an active lock.
void release (void)
 Release a held lock programmatically.
 ~exclusive_access ()
 Destroy reference to exclusively locked object, release lock.

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@gnutelephony.org>

Definition at line 138 of file access.h.


Constructor & Destructor Documentation

ucommon::exclusive_access::exclusive_access ( ExclusiveAccess object  ) 

Create an instance of an exclusive object reference.

Parameters:
object containing Exclusive base class protocol to lock.


Member Function Documentation

ucommon::exclusive_access::operator bool (  )  [inline]

Test if the reference holds an active lock.

Returns:
true if locking an object.

Definition at line 166 of file access.h.

References ucommon::lock().

Here is the call graph for this function:

bool ucommon::exclusive_access::operator! (  )  [inline]

Test if the reference holds an active lock.

Returns:
true if is not locking an object.

Definition at line 159 of file access.h.

References ucommon::lock().

Here is the call graph for this function:

void ucommon::exclusive_access::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.

Referenced by ucommon::release().


The documentation for this class was generated from the following file:
Generated on 14 Aug 2013 for UCommon by  doxygen 1.4.7