Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsnSequentialSemaphore Class Reference

PsnSequentialSemaphore class. More...

#include <PsnSequentialSemaphore.h>

Inheritance diagram for PsnSequentialSemaphore:

Inheritance graph
[legend]
Collaboration diagram for PsnSequentialSemaphore:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsnSequentialSemaphore (const int valeurInitiale)
 Constructor.

virtual ~PsnSequentialSemaphore ()
 Destructor.

virtual int V ()
 V Increments the semphore value and signals the change to blocked threads.

virtual int P ()
 P decrement the sempaphore value and block the calling thread if this value is negative.


Private Attributes

int v
 the value associated to the semaphore


Detailed Description

PsnSequentialSemaphore class.

generic semaphore when only one thread is supposed to exist

Author:
D. Margery
Version:
1.1

Definition at line 28 of file PsnSequentialSemaphore.h.


Constructor & Destructor Documentation

PsnSequentialSemaphore::PsnSequentialSemaphore const int    valeurInitiale
 

Constructor.

Parameters:
int initial value of the semaphore

Definition at line 21 of file PsnSequentialSemaphore.cxx.

References v.

00021                                                                         : PsnSemaphore(valeurInitiale){
00022   v=valeurInitiale;
00023 }

PsnSequentialSemaphore::~PsnSequentialSemaphore   [virtual]
 

Destructor.

Definition at line 25 of file PsnSequentialSemaphore.cxx.

00025                                                 {
00026 }


Member Function Documentation

int PsnSequentialSemaphore::P   [virtual]
 

P decrement the sempaphore value and block the calling thread if this value is negative.

Returns:
: old value of the semaphore

Implements PsnSemaphore.

Definition at line 33 of file PsnSequentialSemaphore.cxx.

References PsController::error(), and v.

00033                               {
00034   v--;
00035   if (v<0) {
00036     PsController::error("PsnSequentialSemaphore : P : interblocage");
00037   }
00038   return (v+1);
00039 }

int PsnSequentialSemaphore::V   [virtual]
 

V Increments the semphore value and signals the change to blocked threads.

Returns:
: new value of the semaphore

Implements PsnSemaphore.

Definition at line 28 of file PsnSequentialSemaphore.cxx.

References v.

00028                               {
00029   v++;
00030   return v;
00031 }


Member Data Documentation

int PsnSequentialSemaphore::v [private]
 

the value associated to the semaphore

Definition at line 57 of file PsnSequentialSemaphore.h.

Referenced by P(), PsnSequentialSemaphore(), and V().


The documentation for this class was generated from the following files:
logo OpenMask

Documentation generated on Mon Nov 25 15:26:28 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001