ucc::shared_lock Class Reference

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

#include <access.h>

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

Public Member Functions

 shared_lock (Shared *object)
 Create an instance of an exclusive object reference.
 ~shared_lock ()
 Destroy reference to shared locked object, release lock.
bool operator! ()
 Test if the reference holds an active lock.
 operator bool ()
 Test if the reference holds an active lock.
void release (void)
 Release a held lock programatically.
void exclusive (void)
 Call exclusive access on referenced objects protocol.
void share (void)
 Restore shared access on referenced objects protocol.

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

Definition at line 167 of file access.h.


Constructor & Destructor Documentation

ucc::shared_lock::shared_lock ( Shared object  ) 

Create an instance of an exclusive object reference.

Parameters:
object containing Exclusive base class protocol to lock.

Member Function Documentation

ucc::shared_lock::operator bool (  )  [inline]

Test if the reference holds an active lock.

Returns:
true if locking an object.

Definition at line 197 of file access.h.

bool ucc::shared_lock::operator! (  )  [inline]

Test if the reference holds an active lock.

Returns:
true if is not locking an object.

Definition at line 190 of file access.h.

void ucc::shared_lock::release ( void   ) 

Release a held lock programatically.

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.


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

Generated by  doxygen 1.6.2