Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ACE_Lock_Adapter< ACE_LOCKING_MECHANISM > Class Template Reference

This is an adapter that allows applications to transparently combine the <ace_lock> abstract base class (which contains pure virtual methods) with any of the other concrete ACE synchronization classes (e.g., <ace_mutex>, <ace_semaphore>, <ace_rw_mutex>, etc.). More...

#include <Lock_Adapter_T.h>

Inheritance diagram for ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_LOCKING_MECHANISM ACE_LOCK

Public Member Functions

 ACE_Lock_Adapter (ACE_LOCKING_MECHANISM &lock)
 Constructor. All locking requests will be forwarded to <lock>.
 ACE_Lock_Adapter (void)
virtual ~ACE_Lock_Adapter (void)
virtual int acquire (void)
 Block the thread until the lock is acquired.
virtual int tryacquire (void)
 Conditionally acquire the lock (i.e., won't block).
virtual int release (void)
 Release the lock.
virtual int acquire_read (void)
virtual int acquire_write (void)
virtual int tryacquire_read (void)
virtual int tryacquire_write (void)
virtual int tryacquire_write_upgrade (void)
virtual int remove (void)
 Explicitly destroy the lock.

Private Attributes

ACE_LOCKING_MECHANISM * lock_
 The concrete locking mechanism that all the methods delegate to.
int delete_lock_

Detailed Description

template<class ACE_LOCKING_MECHANISM>
class ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >

This is an adapter that allows applications to transparently combine the <ace_lock> abstract base class (which contains pure virtual methods) with any of the other concrete ACE synchronization classes (e.g., <ace_mutex>, <ace_semaphore>, <ace_rw_mutex>, etc.).

This class uses a form of the Adapter pattern.


Member Typedef Documentation

template<class ACE_LOCKING_MECHANISM>
typedef ACE_LOCKING_MECHANISM ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::ACE_LOCK
 


Constructor & Destructor Documentation

template<class ACE_LOCKING_MECHANISM>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::ACE_Lock_Adapter ACE_LOCKING_MECHANISM &  lock  ) 
 

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

template<class ACE_LOCKING_MECHANISM>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::ACE_Lock_Adapter void   ) 
 

Constructor. Since no lock is provided by the user, one will be created internally.

template<class ACE_LOCKING_MECHANISM>
ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::~ACE_Lock_Adapter void   )  [virtual]
 

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


Member Function Documentation

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::acquire void   )  [virtual]
 

Block the thread until the lock is acquired.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::acquire_read void   )  [virtual]
 

Block until the thread acquires a read lock. If the locking mechanism doesn't support read locks then this just calls <acquire>.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::acquire_write void   )  [virtual]
 

Block until the thread acquires a write lock. If the locking mechanism doesn't support read locks then this just calls <acquire>.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::release void   )  [virtual]
 

Release the lock.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::remove void   )  [virtual]
 

Explicitly destroy the lock.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire void   )  [virtual]
 

Conditionally acquire the lock (i.e., won't block).

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_read void   )  [virtual]
 

Conditionally acquire a read lock. If the locking mechanism doesn't support read locks then this just calls <acquire>.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_write void   )  [virtual]
 

Conditionally acquire a write lock. If the locking mechanism doesn't support read locks then this just calls <acquire>.

Implements ACE_Lock.

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_write_upgrade void   )  [virtual]
 

Conditionally try to upgrade a lock held for read to a write lock. If the locking mechanism doesn't support read locks then this just calls <acquire>. Returns 0 on success, -1 on failure.

Implements ACE_Lock.


Member Data Documentation

template<class ACE_LOCKING_MECHANISM>
int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::delete_lock_ [private]
 

This flag keep track of whether we are responsible for deleting the lock

template<class ACE_LOCKING_MECHANISM>
ACE_LOCKING_MECHANISM* ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::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 Sun Mar 5 15:39:16 2006 for ACE by  doxygen 1.3.9.1