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

PsnMutexLock Class Reference

class PsnMutexLock. More...

#include <PsnMutexLock.h>

List of all members.

Public Methods

 PsnMutexLock ()
 constructor

virtual ~PsnMutexLock ()
 destructor

int protect ()
 not virtual, cause this is an implementation class, tied to phtreads

int unprotect ()
 not virtual, cause this is an implementation class, tied to phtreads


Protected Attributes

pthread_mutex_t mutex

Friends

class PsnCondition


Detailed Description

class PsnMutexLock.

A class for ensuring mutual exclusion in multithreaded situations.

Author:
D. Margery
Version:
1.0

Definition at line 30 of file PsnMutexLock.h.


Constructor & Destructor Documentation

PsnMutexLock::PsnMutexLock  
 

constructor

Definition at line 28 of file PsnMutexLock.cxx.

References PsController::error(), and mutex.

00028                            {
00029 #ifdef NDEBUG
00030    int ret =
00031 #endif
00032       pthread_mutex_init(&mutex , NULL);
00033 #ifdef NDEBUG
00034    if (ret) {
00035       PsController::error("PsnMutexLock::PsnMutexLock() failed");
00036    }
00037 #endif
00038 }

PsnMutexLock::~PsnMutexLock   [virtual]
 

destructor

Definition at line 40 of file PsnMutexLock.cxx.

References PsController::error(), and mutex.

00040                             {
00041 #ifdef NDEBUG
00042    int ret = 
00043 #endif
00044       pthread_mutex_destroy( &mutex );
00045 #ifdef NDEBUG
00046    if (ret) {
00047       PsController::error("PsnMutexLock::~PsnMutexLock() failed");
00048    }
00049 #endif
00050 }


Member Function Documentation

int PsnMutexLock::protect  
 

not virtual, cause this is an implementation class, tied to phtreads

Definition at line 52 of file PsnMutexLock.cxx.

References PsController::error(), and mutex.

Referenced by PsController::actOnSystemEvent(), PsController::addToPendingEvents(), PsController::addToPendingRegistrations(), PsnSignalDispatcher::cancelRegistrationForSignal(), PsOutput< Type >::connectedMyself(), PsObjectDescriptor::createDescribedObject(), PsOutput< Type >::disconnectedMyself(), PsnThreadMemoryManager::freeLeakedMemoryBlocks(), PsnThreadMemoryManager::freeSizeRemembered(), PsMultiThreadedPvmController::getPointerToSimulatedObjectNamed(), PsnMemoryManager::init(), PsNoRefCountingNameServer< STLallocator >::lock(), PsNameServerT< STLallocator >::lock(), PsnSharedMemoryManager::lockIfNeeded(), PsOutput< Type >::notifyConnectedSensitiveInputs(), PsnReferenceObjectHandle::receiveEvent(), PsnSignalDispatcher::registerForSignal(), PsController::removeFromPendingRegistrations(), PsnMultiThreadedAsynchronousScheduler::runAsynchronous(), PsnMultiThreadedAsynchronousScheduler::runStep(), PsnMultiThreadedAsynchronousScheduler::schedule(), PsnSignalDispatcher::sendEventsForSignal(), PsnReferenceObjectHandle::switchEventList(), PsnSharedMemoryManager::unlockIfNeeded(), PsnMultiThreadedAsynchronousScheduler::unschedule(), PsnMemoryManager::whichMemoryManager(), PsnMemoryManager::~PsnMemoryManager(), and PsOutput< Type >::~PsOutput().

00052                           {
00053 #ifdef _DEBUGLOCK
00054    cerr<<"PsnMutexLock::"<<this<<"::protect(";
00055 #endif
00056 #ifdef NDEBUG
00057    int ret = 
00058 #endif
00059    pthread_mutex_lock( &mutex );
00060 #ifdef NDEBUG
00061    if (ret) {
00062       PsController::error("PsnMutexLock::protect failed");
00063    }
00064 #endif
00065 #ifdef _DEBUGLOCK
00066    cerr<<") effective for thread "<<pthread_self()<<endl;
00067 #endif
00068    return 0;
00069 }

int PsnMutexLock::unprotect  
 

not virtual, cause this is an implementation class, tied to phtreads

Definition at line 71 of file PsnMutexLock.cxx.

References PsController::error(), and mutex.

Referenced by PsController::actOnSystemEvent(), PsController::addToPendingEvents(), PsController::addToPendingRegistrations(), PsnSignalDispatcher::cancelRegistrationForSignal(), PsOutput< Type >::connectedMyself(), PsObjectDescriptor::createDescribedObject(), PsOutput< Type >::disconnectedMyself(), PsnThreadMemoryManager::freeLeakedMemoryBlocks(), PsnThreadMemoryManager::freeSizeRemembered(), PsMultiThreadedPvmController::getPointerToSimulatedObjectNamed(), PsnMemoryManager::init(), PsnSharedMemoryManager::lockIfNeeded(), PsOutput< Type >::notifyConnectedSensitiveInputs(), PsnReferenceObjectHandle::receiveEvent(), PsnSignalDispatcher::registerForSignal(), PsController::removeFromPendingRegistrations(), PsnMultiThreadedAsynchronousScheduler::runAsynchronous(), PsnMultiThreadedAsynchronousScheduler::runStep(), PsnMultiThreadedAsynchronousScheduler::schedule(), PsnSignalDispatcher::sendEventsForSignal(), PsnReferenceObjectHandle::switchEventList(), PsNoRefCountingNameServer< STLallocator >::unlock(), PsNameServerT< STLallocator >::unlock(), PsnSharedMemoryManager::unlockIfNeeded(), PsnMultiThreadedAsynchronousScheduler::unschedule(), PsnMemoryManager::whichMemoryManager(), PsnMemoryManager::~PsnMemoryManager(), and PsOutput< Type >::~PsOutput().

00071                             {
00072 #ifdef _DEBUGLOCK
00073    cerr<<"PsnMutexLock::"<<this<<"::unprotect(";
00074 #endif
00075 #ifdef NDEBUG
00076    int ret = 
00077 #endif
00078       pthread_mutex_unlock( &mutex );
00079 #ifdef NDEBUG
00080    if (ret) {
00081       PsController::error("PsnMutexLock::unprotect failed");
00082    }
00083 #endif
00084 #ifdef _DEBUGLOCK
00085    cerr<<") effective for thread "<<pthread_self()<<endl;
00086 #endif
00087    return 0;
00088 }


Friends And Related Function Documentation

friend class PsnCondition [friend]
 

Definition at line 45 of file PsnMutexLock.h.


Member Data Documentation

pthread_mutex_t PsnMutexLock::mutex [protected]
 

Definition at line 46 of file PsnMutexLock.h.

Referenced by protect(), PsnMutexLock(), unprotect(), PsnCondition::waitForChange(), and ~PsnMutexLock().


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

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

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