FDO API Reference Feature Data Objects
Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

FdoSemaphore Class Reference

#include <Semaphore.h>

Inherits FdoIDisposable.

Inheritance diagram for FdoSemaphore:

[legend]
List of all members.

Detailed Description

DOXYGEN-IGNORE FdoSemaphore is a semaphore class. It is used to prevent operations from happening concurrently or re-entrantly. FdoSemaphore is not currently part of the FDO API but can be added if there is a demand. It is a wrapper class around a boolean semaphore.

FdoSemaphore can be used to prevent a member function on another class from being called re-entrantly for the same object (see FdoXmlReaderXrcs::Parse()) for an example. This can be done by declaring a FdoSemaphoreP, at the start of the function, that takes a boolean member and an exception. The boolean member must initially be false. When the FdoSemaphoreP is created, the boolean member is set to true. When the function exits, FdoSemaphoreP goes out of scope and sets the boolean member back to false. However, if the function is called a second time before the first invokation finishes, the second FdoSemaphoreP created will detect that the boolean member is true, and it will throw the given exception, thus rejecting the re-entrant function call.

Definition at line 40 of file Semaphore.h.


Static Public Member Functions

FdoSemaphoreCreate (FdoBoolean &semaphore, FdoException *ex)
 Constructs a new semaphore.

Protected Member Functions

virtual void Dispose ()
 Dispose this object.
 FdoSemaphore (bool &semaphore, FdoException *ex)
 FdoSemaphore ()
virtual ~FdoSemaphore ()

Constructor & Destructor Documentation

FdoSemaphore::FdoSemaphore  )  [inline, protected]
 

Definition at line 61 of file Semaphore.h.

Referenced by Create().

FdoSemaphore::FdoSemaphore bool &  semaphore,
FdoException ex
[protected]
 

virtual FdoSemaphore::~FdoSemaphore  )  [protected, virtual]
 


Member Function Documentation

FdoSemaphore* FdoSemaphore::Create FdoBoolean semaphore,
FdoException ex
[inline, static]
 

Constructs a new semaphore.

Parameters:
semaphore Input the semaphore switch. If true, then the given exception is thrown. If false, then semaphore is set to true. semaphore is set back to false when this object is deleted.
ex Input the exception to throw when semaphore is true.
Returns:
Returns FdoSemaphore

Definition at line 55 of file Semaphore.h.

References FdoSemaphore().

Here is the call graph for this function:

virtual void FdoSemaphore::Dispose  )  [inline, protected, virtual]
 

Dispose this object.

Returns:
Returns nothing

Implements FdoIDisposable.

Definition at line 65 of file Semaphore.h.


The documentation for this class was generated from the following file:
Comments or suggestions? Send us feedback.