An adaptive general locking class that defers the decision of lock type to run time. More...
#include <Lock.h>
Public Member Functions | |
virtual | ~ACE_Adaptive_Lock (void) |
virtual int | remove (void) |
virtual int | acquire (void) |
virtual int | tryacquire (void) |
virtual int | release (void) |
Release the lock. Returns -1 on failure. | |
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) |
void | dump (void) const |
Protected Member Functions | |
ACE_Adaptive_Lock (void) | |
Protected Attributes | |
ACE_Lock * | lock_ |
An adaptive general locking class that defers the decision of lock type to run time.
This class, as ACE_Lock, provide a set of general locking APIs. However, it defers our decision of what kind of lock to use to the run time and delegates all locking operations to the actual lock. Users must define a constructor in their subclass to initialize <lock_>.
Definition at line 123 of file Lock.h.
ACE_Adaptive_Lock::~ACE_Adaptive_Lock | ( | void | ) | [virtual] |
ACE_Adaptive_Lock::ACE_Adaptive_Lock | ( | void | ) | [protected] |
int ACE_Adaptive_Lock::acquire | ( | void | ) | [virtual] |
int ACE_Adaptive_Lock::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>. Returns -1 on failure.
Implements ACE_Lock.
Definition at line 51 of file Lock.cpp.
{ return this->lock_->acquire_read (); }
int ACE_Adaptive_Lock::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>. Returns -1 on failure.
Implements ACE_Lock.
Definition at line 57 of file Lock.cpp.
{ return this->lock_->acquire_write (); }
void ACE_Adaptive_Lock::dump | ( | void | ) | const |
int ACE_Adaptive_Lock::release | ( | void | ) | [virtual] |
int ACE_Adaptive_Lock::remove | ( | void | ) | [virtual] |
int ACE_Adaptive_Lock::tryacquire | ( | void | ) | [virtual] |
Conditionally acquire the lock (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
Implements ACE_Lock.
Definition at line 39 of file Lock.cpp.
{ return this->lock_->tryacquire (); }
int ACE_Adaptive_Lock::tryacquire_read | ( | void | ) | [virtual] |
Conditionally acquire a read lock. If the locking mechanism doesn't support read locks then this just calls <acquire>. Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
Implements ACE_Lock.
Definition at line 63 of file Lock.cpp.
{ return this->lock_->tryacquire_read (); }
int ACE_Adaptive_Lock::tryacquire_write | ( | void | ) | [virtual] |
Conditionally acquire a write lock. If the locking mechanism doesn't support read locks then this just calls <acquire>. Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
Implements ACE_Lock.
Definition at line 69 of file Lock.cpp.
{ return this->lock_->tryacquire_write (); }
int ACE_Adaptive_Lock::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.
Definition at line 75 of file Lock.cpp.
{ return this->lock_->tryacquire_write_upgrade (); }
ACE_Lock* ACE_Adaptive_Lock::lock_ [protected] |