UCommon
Public Member Functions
ucc::exclusive_lock Class Reference

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

#include <access.h>

Collaboration diagram for ucc::exclusive_lock:
Collaboration graph
[legend]

Public Member Functions

 exclusive_lock (Exclusive *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_lock ()
 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 126 of file access.h.


Constructor & Destructor Documentation

ucc::exclusive_lock::exclusive_lock ( Exclusive object)

Create an instance of an exclusive object reference.

Parameters:
objectcontaining Exclusive base class protocol to lock.

Member Function Documentation

ucc::exclusive_lock::operator bool ( ) const [inline]

Test if the reference holds an active lock.

Returns:
true if locking an object.

Definition at line 154 of file access.h.

Here is the call graph for this function:

bool ucc::exclusive_lock::operator! ( ) const [inline]

Test if the reference holds an active lock.

Returns:
true if is not locking an object.

Definition at line 147 of file access.h.

Here is the call graph for this function:

void ucc::exclusive_lock::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: