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

# ACE_Guard Class Template Reference

This data structure is meant to be used within a method or function... It performs automatic aquisition and release of a parameterized synchronization object . More...

`#include <Synch_T.h>`

Inheritance diagram for ACE_Guard

[legend]
List of all members.

## Public Methods
| ACE_Guard (ACE_LOCK &l)
| ACE_Guard (ACE_LOCK &l, int block)
| Implicitly and automatically acquire (or try to acquire) the lock. If <block> is non-0 then the , else <tryacquire> it.
| ACE_Guard (ACE_LOCK &l, int block, int become_owner)
| Initialise the guard without implicitly acquiring the lock. The <become_owner> parameter indicates whether the guard should release the lock implicitly on destruction. The <block> parameter is ignored and is used here to disambiguate with the preceding constructor.
| ~ACE_Guard (void)
| Implicitly release the lock.
int | acquire (void)
| Explicitly acquire the lock.
int | tryacquire (void)
| Conditionally acquire the lock (i.e., won't block).
int | release (void)
| Explicitly release the lock, but only if it is held!
void | disown (void)
| Relinquish ownership of the lock so that it is not released implicitly in the destructor.
int | locked (void) const
| 1 if locked, 0 if couldn't acquire the lock (errno will contain the reason for this).
int | remove (void)
| Explicitly remove the lock.
void | dump (void) const
| Dump the state of an object.
## Protected Methods
| ACE_Guard (ACE_LOCK *lock)
| Helper, meant for subclass only.
## Protected Attributes
ACE_LOCK* | lock_
| Pointer to the ACE_LOCK we're guarding.
int | owner_
| Keeps track of whether we acquired the lock or failed.
## Private Methods
void | operator= (const ACE_Guard<ACE_LOCK> &)
| ACE_Guard (const ACE_Guard<ACE_LOCK> &)

## Detailed Description

### template<class ACE_LOCK> template class ACE_Guard

This data structure is meant to be used within a method or function... It performs automatic aquisition and release of a parameterized synchronization object .

The class given as an actual parameter must provide at the very least the , <tryacquire>, <release>, and <remove> methods.

## Constructor & Destructor Documentation

template<classACE_LOCK>
ACE_INLINE ACE_Guard< ACE_LOCK >::ACE_Guard<ACE_LOCK> ( | ACE_LOCK & l )

template<classACE_LOCK>
ACE_INLINE ACE_Guard< ACE_LOCK >::ACE_Guard<ACE_LOCK> ( | ACE_LOCK & l,
| int block )

| Implicitly and automatically acquire (or try to acquire) the lock. If <block> is non-0 then the , else <tryacquire> it.

template<classACE_LOCK>
ACE_INLINE ACE_Guard< ACE_LOCK >::ACE_Guard<ACE_LOCK> ( | ACE_LOCK & l,
| int block,
| int become_owner )

| Initialise the guard without implicitly acquiring the lock. The <become_owner> parameter indicates whether the guard should release the lock implicitly on destruction. The <block> parameter is ignored and is used here to disambiguate with the preceding constructor.

template<classACE_LOCK>
ACE_INLINE ACE_Guard< ACE_LOCK >::~ACE_Guard<ACE_LOCK> ( | void )

| Implicitly release the lock.

template<classACE_LOCK>
ACE_Guard<ACE_LOCK>::ACE_Guard<ACE_LOCK> ( | ACE_LOCK * lock )`[inline, protected]`

| Helper, meant for subclass only.

template<classACE_LOCK>
ACE_Guard<ACE_LOCK>::ACE_Guard<ACE_LOCK> ( | const ACE_Guard< ACE_LOCK >& )`[private]`

## Member Function Documentation

template<classACE_LOCK>
ACE_INLINE int ACE_Guard< ACE_LOCK >::acquire ( | void )

| Explicitly acquire the lock. Reimplemented in ACE_Write_Guard, and ACE_Read_Guard.

template<classACE_LOCK>
ACE_INLINE void ACE_Guard< ACE_LOCK >::disown ( | void )

| Relinquish ownership of the lock so that it is not released implicitly in the destructor.

template<classACE_LOCK>
void ACE_Guard<ACE_LOCK>::dump ( | void ) const

| Dump the state of an object. Reimplemented in ACE_Write_Guard, and ACE_Read_Guard.

template<classACE_LOCK>
ACE_INLINE int ACE_Guard< ACE_LOCK >::locked ( | void ) const

| 1 if locked, 0 if couldn't acquire the lock (errno will contain the reason for this).

template<classACE_LOCK>
void ACE_Guard<ACE_LOCK>::operator= ( | const ACE_Guard< ACE_LOCK >& )`[private]`

template<classACE_LOCK>
ACE_INLINE int ACE_Guard< ACE_LOCK >::release ( | void )

| Explicitly release the lock, but only if it is held!

template<classACE_LOCK>
ACE_INLINE int ACE_Guard< ACE_LOCK >::remove ( | void )

| Explicitly remove the lock.

template<classACE_LOCK>
ACE_INLINE int ACE_Guard< ACE_LOCK >::tryacquire ( | void )

| Conditionally acquire the lock (i.e., won't block). Reimplemented in ACE_Write_Guard, and ACE_Read_Guard.

## Member Data Documentation

template<classACE_LOCK>
ACE_LOCK * ACE_Guard<ACE_LOCK>::lock_`[protected]`

| Pointer to the ACE_LOCK we're guarding.

template<classACE_LOCK>
int ACE_Guard<ACE_LOCK>::owner_`[protected]`

| Keeps track of whether we acquired the lock or failed.

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

- Synch_T.h
- Synch_T.cpp
- Synch_T.i