PTLib  Version 2.10.4
PWriteWaitAndSignal Class Reference

This class starts a write operation for the PReadWriteMutex on construction and automatically ends the write operation on destruction. More...

#include <syncthrd.h>

List of all members.

Public Member Functions

 PWriteWaitAndSignal (const PReadWriteMutex &rw, PBoolean start=true)
 Create the PWriteWaitAndSignal wait instance.
 ~PWriteWaitAndSignal ()
 End write operation on the PReadWriteMutex.

Protected Attributes

PReadWriteMutexmutex

Detailed Description

This class starts a write operation for the PReadWriteMutex on construction and automatically ends the write operation on destruction.

This is very useful for constructs such as:


    void func()
    {
      PWriteWaitAndSignal mutexWait(myMutex);
      if (condition)
        return;
      do_something();
      if (other_condition)
        return;
      do_something_else();
    }

Constructor & Destructor Documentation

Create the PWriteWaitAndSignal wait instance.

This will wait on the specified PReadWriteMutex using the StartWrite() function before returning.

Parameters:
rwPReadWriteMutex descendent to wait/signal.
startStart write operation on PReadWriteMutex before returning.

End write operation on the PReadWriteMutex.

This will execute the EndWrite() function on the PReadWriteMutex that was used in the construction of this instance.


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines