Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Reverse_Lock Class Template Reference

A reverse (or anti) lock. More...

#include <Synch_T.h>

Inheritance diagram for ACE_Reverse_Lock:

Inheritance graph
[legend]
Collaboration diagram for ACE_Reverse_Lock:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_LOCKING_MECHANISM ACE_LOCK

Public Methods

 ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock, ACE_Acquire_Method::METHOD_TYPE acquire_method=ACE_Acquire_Method::ACE_REGULAR)
 Constructor. All locking requests will be forwarded to <lock>. More...

virtual ~ACE_Reverse_Lock (void)
 Destructor. If <lock_> was not passed in by the user, it will be deleted. More...

virtual int acquire (void)
 Release the lock. More...

virtual int tryacquire (void)
 Release the lock. More...

virtual int release (void)
 Acquire the lock. More...

virtual int acquire_read (void)
 Release the lock. More...

virtual int acquire_write (void)
 Release the lock. More...

virtual int tryacquire_read (void)
 Release the lock. More...

virtual int tryacquire_write (void)
 Release the lock. More...

virtual int tryacquire_write_upgrade (void)
 Release the lock. More...

virtual int remove (void)
 Explicitly destroy the lock. More...


Private Attributes

ACE_LOCKING_MECHANISM & lock_
 The concrete locking mechanism that all the methods delegate to. More...

ACE_Acquire_Method::METHOD_TYPE acquire_method_
 This indicates what kind of acquire method will be called. More...


Detailed Description

template<class ACE_LOCKING_MECHANISM>
class ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >

A reverse (or anti) lock.

This is an interesting adapter class that changes a lock into a reverse lock, i.e., <acquire> on this class calls <release> on the lock, and <release> on this class calls <acquire> on the lock. One motivation for this class is when we temporarily want to release a lock (which we have already acquired) but then reacquire it soon after. An alternative design would be to add a Anti_Guard or Reverse_Guard class which would <release> on construction and <acquire> destruction. However, there are *many* varieties of the Guard class and this design choice would lead to at least 6 new classes. One new ACE_Reverse_Lock class seemed more reasonable.


Member Typedef Documentation

template<class ACE_LOCKING_MECHANISM>
typedef ACE_LOCKING_MECHANISM ACE_Reverse_Lock::ACE_LOCK
 


Constructor & Destructor Documentation

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::ACE_Reverse_Lock ACE_LOCKING_MECHANISM &    lock,
ACE_Acquire_Method::METHOD_TYPE    acquire_method = ACE_Acquire_Method::ACE_REGULAR
 

Constructor. All locking requests will be forwarded to <lock>.

template<class ACE_LOCKING_MECHANISM>
ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::~ACE_Reverse_Lock void    [virtual]
 

Destructor. If <lock_> was not passed in by the user, it will be deleted.


Member Function Documentation

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::acquire void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::acquire_read void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::acquire_write void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::release void    [virtual]
 

Acquire the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::remove void    [virtual]
 

Explicitly destroy the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::tryacquire void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::tryacquire_read void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::tryacquire_write void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
ACE_INLINE int ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >::tryacquire_write_upgrade void    [virtual]
 

Release the lock.

Reimplemented from ACE_Lock.


Member Data Documentation

template<class ACE_LOCKING_MECHANISM>
ACE_Acquire_Method::METHOD_TYPE ACE_Reverse_Lock::acquire_method_ [private]
 

This indicates what kind of acquire method will be called.

template<class ACE_LOCKING_MECHANISM>
ACE_LOCKING_MECHANISM& ACE_Reverse_Lock::lock_ [private]
 

The concrete locking mechanism that all the methods delegate to.


The documentation for this class was generated from the following files:
Generated on Thu Oct 10 17:11:48 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001