exclusive_access Class Reference

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

#include <access.h>

Collaboration diagram for exclusive_access:
Collaboration graph
[legend]

Public Member Functions

 exclusive_access (ExclusiveAccess *object)
 Create an instance of an exclusive object reference.
 operator bool () const
 Test if the reference holds an active lock.
bool operator! () const
 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

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

exclusive_access::operator bool (  )  const [inline]

Test if the reference holds an active lock.

Returns:
true if locking an object.

Definition at line 166 of file access.h.

Here is the call graph for this function:

bool exclusive_access::operator! (  )  const [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.

Here is the call graph for this function:

void 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.


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

Generated on 24 Sep 2014 for ucommon by  doxygen 1.6.1