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

PsnCondition Class Reference

C++ wrapper to pthread conditions. More...

#include <PsnCondition.h>

List of all members.

Public Methods

 PsnCondition ()
 constructor

 ~PsnCondition ()
 destructor

void signalChange ()
 signal that a change has occured on the condition

void waitForChange (PsnMutexLock &associatedLock)
 wait for a change on the condition


Protected Attributes

pthread_cond_t _myCondition
 the wrapped Pthread condition


Detailed Description

C++ wrapper to pthread conditions.

Beware, no virtual used !

Definition at line 29 of file PsnCondition.h.


Constructor & Destructor Documentation

PsnCondition::PsnCondition  
 

constructor

Definition at line 25 of file PsnCondition.cxx.

References _myCondition, and PsController::error().

00025                            {
00026 #ifdef NDEBUG   
00027    int ret=
00028 #endif
00029       pthread_cond_init( &_myCondition , NULL );
00030 #ifdef NDEBUG
00031    if(ret) {
00032       PsController::error("PsnCondition::PsnCondition initialisation failed");
00033    }   
00034 #endif
00035 }

PsnCondition::~PsnCondition  
 

destructor

Definition at line 39 of file PsnCondition.cxx.

References _myCondition.

00039                             {
00040   pthread_cond_destroy( &_myCondition );
00041 }


Member Function Documentation

void PsnCondition::signalChange  
 

signal that a change has occured on the condition

Definition at line 45 of file PsnCondition.cxx.

References _myCondition, and PsController::error().

Referenced by PsObjectDescriptor::createDescribedObject(), PsMultiThreadedPvmController::getPointerToSimulatedObjectNamed(), PsnMultiThreadedAsynchronousScheduler::runAsynchronous(), PsnMultiThreadedAsynchronousScheduler::runStep(), PsnMultiThreadedAsynchronousScheduler::schedule(), PsnSharedMemoryManager::unlockIfNeeded(), and PsnMultiThreadedAsynchronousScheduler::unschedule().

00045                                  {
00046 #ifdef _DEBUGLOCK
00047    cerr<<"PsnCondition::signalChange ()"<<endl;
00048 #endif
00049 #ifdef NDEBUG   
00050    int ret=
00051 #endif
00052       pthread_cond_signal(&_myCondition);
00053 #ifdef NDEBUG
00054    if(ret) {
00055       PsController::error("PsnCondition::conditionChanged () failed");
00056    }
00057 #endif 
00058 }

void PsnCondition::waitForChange PsnMutexLock   associatedLock
 

wait for a change on the condition

Definition at line 62 of file PsnCondition.cxx.

References _myCondition, PsController::error(), and PsnMutexLock::mutex.

Referenced by PsObjectDescriptor::createDescribedObject(), PsMultiThreadedPvmController::getPointerToSimulatedObjectNamed(), PsnSharedMemoryManager::lockIfNeeded(), and PsnMultiThreadedAsynchronousScheduler::runAsynchronous().

00062                                                                  {
00063 #ifdef _DEBUGLOCK
00064    cerr<<"PsnCondition::waitForChange waiting"<<endl;
00065 #endif
00066 #ifdef NDEBUG   
00067    int ret=
00068 #endif
00069       pthread_cond_wait(&_myCondition,&associatedLock.mutex);
00070 #ifdef NDEBUG
00071    if(ret) {
00072       PsController::error("PsnCondition::waitForChange failed");
00073     }
00074 #endif
00075 #ifdef _DEBUGLOCK
00076    cerr<<"PsnCondition::waitForChange change happened"<<endl;
00077 #endif
00078 }


Member Data Documentation

pthread_cond_t PsnCondition::_myCondition [protected]
 

the wrapped Pthread condition

Definition at line 45 of file PsnCondition.h.

Referenced by PsnCondition(), signalChange(), waitForChange(), and ~PsnCondition().


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

Documentation generated on Mon Nov 25 15:25:54 2002

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