ACE_Guard(3)

ACE_Guard3

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

Usage

#include <ace/Synch_T.h>
template<class ACE_LOCK>
class ACE_Guard
{
  public:
    ACE_Guard (ACE_LOCK &l);
    ACE_Guard (ACE_LOCK &l, int block);
    ~ACE_Guard (void);
    int acquire (void);
    int tryacquire (void);
    int release (void);
    int locked (void);
    int remove (void);
    void dump (void) const;
  protected:
    inline ACE_Guard (ACE_LOCK *lock);
    ACE_LOCK *lock_;
    int owner_;
  private:
    inline ACE_UNIMPLEMENTED_FUNC (
        void operator= (const ACE_Guard<ACE_LOCK> &)
        );
};

Overview

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

Initialization and termination methods.

ACE_Guard (ACE_LOCK &l);
ACE_Guard (ACE_LOCK &l, int block);

Implicitly and automatically acquire (or try to acquire) the lock.

~ACE_Guard (void);

Implicitly release the lock.

Lock accessors.

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!

Utility methods.

int locked (void);

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.

ACE_ALLOC_HOOK_DECLARE; Declare the dynamic allocation hooks.

Prevent assignment and initialization.

inline ACE_UNIMPLEMENTED_FUNC (
    void operator= (const ACE_Guard<ACE_LOCK> &)
    );

Library

ace

Author

Doug Schmidt

From libace-doc 5.0.7-4 in Debian 2.2 (Potato). Parsed by carta from the page's man source.