Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

PWaitAndSignal Class Reference

#include <semaphor.h>

List of all members.

Public Member Functions

 PWaitAndSignal (const PSemaphore &sem, BOOL wait=TRUE)
 ~PWaitAndSignal ()

Protected Attributes

PSemaphoresemaphore


Detailed Description

This class waits for the semaphore on construction and automatically signals the semaphore on destruction. Any descendent of PSemaphore may be used.

This is very usefull for constructs such as: {verbatim} void func() { PWaitAndSignal mutexWait(myMutex); if (condition) return; do_something(); if (other_condition) return; do_something_else(); } {verbatim}


Constructor & Destructor Documentation

PINLINE PWaitAndSignal::PWaitAndSignal const PSemaphore sem,
BOOL  wait = TRUE
 

Create the semaphore wait instance. This will wait on the specified semaphore using the #Wait()# function before returning.

Parameters:
wait  Semaphore descendent to wait/signal. Wait for semaphore before returning.

PINLINE PWaitAndSignal::~PWaitAndSignal  ) 
 

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


Member Data Documentation

PSemaphore& PWaitAndSignal::semaphore [protected]
 


The documentation for this class was generated from the following files:
Generated on Sat Jul 24 15:36:00 2004 for PWLib by doxygen 1.3.7