Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Lock Class Reference

The Lock class represents a way to automatically lock or unlock a syncronizeable primitive, like a thread, mutex, or semaphore, by having the lifetime of the Lock stack based. More...

#include <vcf/FoundationKit/Lock.h>

Inheritance diagram for VCF::Lock:

VCF::Object List of all members.

Public Member Functions

 Lock (VCF::SynchObject &synchObject)
virtual ~Lock ()

Protected Attributes

bool validSynchObject_
VCF::SynchObjectsynchObject_

Detailed Description

The Lock class represents a way to automatically lock or unlock a syncronizeable primitive, like a thread, mutex, or semaphore, by having the lifetime of the Lock stack based.

This frees the developer from having to remember to call lock or unlock on the sync object. For example:

Mutex* mutex = //get a mutex
Lock l( *mutex );
//do some operations on a shared resource
When the lock instance falls off of the stack, and it's destructor is called, and the sync object's unlock method will be called.
See also:
SynchObject
Author:
Tiziano Franzoi, Nov 15, 2001


Constructor & Destructor Documentation

VCF::Lock::Lock VCF::SynchObject synchObject  )  [inline]
 

virtual VCF::Lock::~Lock  )  [inline, virtual]
 


Member Data Documentation

VCF::SynchObject& VCF::Lock::synchObject_ [protected]
 

bool VCF::Lock::validSynchObject_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information