ACE_Lock Class Reference

This is the abstract base class that contains the uniform locking API that is supported by all the ACE synchronization mechanisms. More...

#include <Lock.h>

Inheritance diagram for ACE_Lock:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ACE_Lock (void)
 CE needs a default ctor here.

virtual ~ACE_Lock (void)
 Noop virtual destructor.

virtual int remove (void)=0
virtual int acquire (void)=0
virtual int tryacquire (void)=0
virtual int release (void)=0
 Release the lock. Returns -1 on failure.

virtual int acquire_read (void)=0
virtual int acquire_write (void)=0
virtual int tryacquire_read (void)=0
virtual int tryacquire_write (void)=0
virtual int tryacquire_write_upgrade (void)=0

Detailed Description

This is the abstract base class that contains the uniform locking API that is supported by all the ACE synchronization mechanisms.

This class is typically used in conjunction with the in order to provide a polymorphic interface to the ACE synchronization mechanisms (e.g., , , , etc). Note that the reason that all of ACE doesn't use polymorphic locks is that (1) they add ~20% extra overhead for virtual function calls and (2) objects with virtual functions can't be placed into shared memory.

Definition at line 43 of file Lock.h.


Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Lock::ACE_Lock void   ) 
 

CE needs a default ctor here.

Definition at line 8 of file Lock.inl.

00009 {
00010 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Lock::~ACE_Lock void   )  [virtual]
 

Noop virtual destructor.

Definition at line 13 of file Lock.cpp.

00014 {
00015 }


Member Function Documentation

virtual int ACE_Lock::acquire void   )  [pure virtual]
 

Block the thread until the lock is acquired. Returns -1 on failure.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::acquire().

virtual int ACE_Lock::acquire_read void   )  [pure virtual]
 

Block until the thread acquires a read lock. If the locking mechanism doesn't support read locks then this just calls . Returns -1 on failure.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::acquire_read().

virtual int ACE_Lock::acquire_write void   )  [pure virtual]
 

Block until the thread acquires a write lock. If the locking mechanism doesn't support read locks then this just calls . Returns -1 on failure.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::acquire_write().

virtual int ACE_Lock::release void   )  [pure virtual]
 

Release the lock. Returns -1 on failure.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::release().

virtual int ACE_Lock::remove void   )  [pure virtual]
 

Explicitly destroy the lock. Note that only one thread should call this method since it doesn't protect against race conditions.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::remove().

virtual int ACE_Lock::tryacquire void   )  [pure virtual]
 

Conditionally acquire the lock (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, is set to .

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::tryacquire().

virtual int ACE_Lock::tryacquire_read void   )  [pure virtual]
 

Conditionally acquire a read lock. If the locking mechanism doesn't support read locks then this just calls . Returns -1 on failure. If we "failed" because someone else already had the lock, is set to .

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::tryacquire_read().

virtual int ACE_Lock::tryacquire_write void   )  [pure virtual]
 

Conditionally acquire a write lock. If the locking mechanism doesn't support read locks then this just calls . Returns -1 on failure. If we "failed" because someone else already had the lock, is set to .

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::tryacquire_write().

virtual int ACE_Lock::tryacquire_write_upgrade void   )  [pure 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 . Returns 0 on success, -1 on failure.

Implemented in ACE_Adaptive_Lock, ACE_Lock_Adapter< ACE_LOCKING_MECHANISM >, ACE_Reverse_Lock< ACE_LOCKING_MECHANISM >, ACE_Lock_Adapter< ACE_SELECT_REACTOR_TOKEN >, ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token >, ACE_Lock_Adapter< ACE_Process_Mutex >, and ACE_Lock_Adapter< ACE_Select_Reactor_Token >.

Referenced by ACE_Adaptive_Lock::tryacquire_write_upgrade().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:23:49 2006 for ACE by doxygen 1.3.6