ACE 8.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
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]

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 ()
 
virtual ~ACE_Lock_Adapter ()
 
virtual int acquire ()
 Block the thread until the lock is acquired.
 
virtual int tryacquire ()
 Conditionally acquire the lock (i.e., won't block).
 
virtual int release ()
 Release the lock.
 
virtual int acquire_read ()
 
virtual int acquire_write ()
 
virtual int tryacquire_read ()
 
virtual int tryacquire_write ()
 
virtual int tryacquire_write_upgrade ()
 
virtual int remove ()
 Explicitly destroy the lock.
 
- Public Member Functions inherited from ACE_Lock
 ACE_Lock ()
 CE needs a default constructor here.
 
virtual ~ACE_Lock ()=default
 Noop virtual destructor.
 

Private Attributes

ACE_LOCKING_MECHANISMlock_
 The concrete locking mechanism that all the methods delegate to.
 
bool 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

◆ ACE_LOCK

Constructor & Destructor Documentation

◆ ACE_Lock_Adapter() [1/2]

Constructor. All locking requests will be forwarded to lock.

◆ ACE_Lock_Adapter() [2/2]

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

◆ ~ACE_Lock_Adapter()

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

Member Function Documentation

◆ acquire()

Block the thread until the lock is acquired.

Implements ACE_Lock.

◆ acquire_read()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::acquire_read ( )
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.

◆ acquire_write()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::acquire_write ( )
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.

◆ release()

Release the lock.

Implements ACE_Lock.

◆ remove()

Explicitly destroy the lock.

Implements ACE_Lock.

◆ tryacquire()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire ( )
virtual

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

Implements ACE_Lock.

◆ tryacquire_read()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_read ( )
virtual

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

Implements ACE_Lock.

◆ tryacquire_write()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_write ( )
virtual

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

Implements ACE_Lock.

◆ tryacquire_write_upgrade()

int ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >::tryacquire_write_upgrade ( )
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

◆ delete_lock_

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

◆ lock_

The concrete locking mechanism that all the methods delegate to.


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