## NAME

ACE_Write_Guard - This class is similar to class `ACE_Guard`, though it acquires/releases a write lock automatically (naturally, the `ACE_LOCK` it is instantiated with must support the appropriate API).

## SYNOPSIS

    #include <ace/Synch_T.h>

    template<class ACE_LOCK>
    class ACE_Write_Guard : public ACE_Guard<ACE_LOCK>
    {
      public:
        inline ACE_Write_Guard (ACE_LOCK &m): ACE_Guard<ACE_LOCK> (&m);
        inline ACE_Write_Guard (
            ACE_LOCK &m,
            int block): ACE_Guard<ACE_LOCK> (&m
            );
        inline int acquire_write (void);
        inline int acquire (void);
        inline int tryacquire_write (void);
        inline int tryacquire (void);
        void dump (void) const;
    };

## Initialization method.

    inline ACE_Write_Guard (ACE_LOCK &m): ACE_Guard<ACE_LOCK> (&m);

Implicitly and automatically acquire a write lock.

    inline ACE_Write_Guard (
        ACE_LOCK &m,
        int block): ACE_Guard<ACE_LOCK> (&m
        );

Implicitly and automatically acquire (or try to acquire) a write lock.

## Lock accessors.

    inline int acquire_write (void);

Explicitly acquire the write lock.

    inline int acquire (void);

Explicitly acquire the write lock.

    inline int tryacquire_write (void);

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

    inline int tryacquire (void);

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

Utility methods.

    void dump (void) const;

Dump the state of an object.

ACE_ALLOC_HOOK_DECLARE; Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace