CoreLinux++  0.4.32
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
corelinux::CoreLinuxGuardPool Class Reference

The CoreLinuxGuardPool is a private SemaphoreGroup resource for class objects that require synchronization capability. More...

#include <CoreLinuxGuardPool.hpp>

Public Member Functions

 CoreLinuxGuardPool (Short numInit=8, Short numExt=0) throw ( Assertion )
 Default constructor. More...
 
virtual ~CoreLinuxGuardPool (void)
 Virtual destructor.
 

Static Public Member Functions

static bool isLocked (SynchronizedPtr) throw ( SemaphoreException )
 isLocked determines if the object is currently locked. More...
 
static Short getInitialPoolSize (void)
 Return the initial guard count in the pool.
 
static Short getExtentSize (void)
 Return the current grow by count for the pool.
 
static Short getTotalCurrentSize (void)
 Return the current guard pool size.
 
static void lock (SynchronizedPtr) throw ( SemaphoreException )
 lock is called by a guard when control is needed over a objects resource access. More...
 
static void release (SynchronizedPtr) throw ( SemaphoreException )
 release is called by a guard object during its destruction. More...
 
static void setExtentSize (Short aExtentSize) throw ( Assertion )
 Run time interface for changing the extent size. More...
 

Protected Member Functions

bool isSynchronizedLocked (SynchronizedPtr) throw ( SemaphoreException )
 isSynchronizedLocked resolves whether Synchronized is in a locked state. More...
 
void lockSynchronized (SynchronizedPtr) throw ( SemaphoreException )
 lockSynchronized manages the associations of objects to the semaphore in the pool in establishing the guard. More...
 
void releaseSynchronized (SynchronizedPtr) throw ( SemaphoreException )
 releaseSynchronized manages the associations of objects to the semaphore in the pool when releasing a guard. More...
 
void createPoolGroup (Short numSems, Short initSize=0)
 createPoolGroup creates a semaphore set with the requested number of semaphores in the group and will add the semaphores to theSemaphores with initial count and index set properly More...
 
void destroyPoolGroup (Index aGroup)
 destroyPoolGroup validates that all the semaphores in the extent are not being used and then destroys the extent and all the semaphores associated with it. More...
 

Static Protected Attributes

static GuardPool theGuard
 Singleton instance.
 
static Short theInitialSize
 Describes the inital pool size.
 
static Short theExtentSize
 Describes the size to add when going into extents.
 

Detailed Description

The CoreLinuxGuardPool is a private SemaphoreGroup resource for class objects that require synchronization capability.

See also
corelinux::Synchronized, corelinux::PoolDescriptor

Constructor & Destructor Documentation

corelinux::CoreLinuxGuardPool::CoreLinuxGuardPool ( Short  numInit = 8,
Short  numExt = 0 
)
throw (Assertion
)

Default constructor.

Parameters
Shortnumber of base semaphores to use in pool
Shortnumber of semaphores to increment by when going into extents. If 0, no extents are allowed.
Exceptions
Assertionif Singleton<CoreLinuxGuardPool> already established.

Member Function Documentation

void corelinux::CoreLinuxGuardPool::createPoolGroup ( Short  numSems,
Short  initSize = 0 
)
protected

createPoolGroup creates a semaphore set with the requested number of semaphores in the group and will add the semaphores to theSemaphores with initial count and index set properly

Parameters
Shortthe semaphore count
Shortthe number to insert into theSemaphores If the default is used, all go into theSemaphores

References corelinux::CoreLinuxGuardGroup::createSemaphore().

void corelinux::CoreLinuxGuardPool::destroyPoolGroup ( Index  aGroup)
protected

destroyPoolGroup validates that all the semaphores in the extent are not being used and then destroys the extent and all the semaphores associated with it.

The method assumes that the group is the last in the vector.

Parameters
Indexthe group index
bool corelinux::CoreLinuxGuardPool::isLocked ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
static

isLocked determines if the object is currently locked.

Calls singleton instance isSynchronizedLocked.

Parameters
Synchronizedpointer of guard owner.
Returns
bool true if locked
bool corelinux::CoreLinuxGuardPool::isSynchronizedLocked ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
protected

isSynchronizedLocked resolves whether Synchronized is in a locked state.

Parameters
Synchronizedpointer of guard owner.
Returns
bool true if locked
Exceptions
SemaphoreExceptionif not of set.
void corelinux::CoreLinuxGuardPool::lock ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
static

lock is called by a guard when control is needed over a objects resource access.

Calls singleton instance lockedSynchronized.

Parameters
Synchronizedpointer of guard owner.
Exceptions
SemaphoreExceptionif out of pool resources

Referenced by corelinux::Synchronized::Guard::Guard().

void corelinux::CoreLinuxGuardPool::lockSynchronized ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
protected

lockSynchronized manages the associations of objects to the semaphore in the pool in establishing the guard.

Parameters
Synchronizedpointer of guard owner.

References getExtentSize(), corelinux::AbstractSemaphore::lockWithWait(), and corelinux::AbstractSemaphore::release().

void corelinux::CoreLinuxGuardPool::release ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
static

release is called by a guard object during its destruction.

Parameters
Synchronizedpointer of guard owner.Calls singleton instance releaseSynchronized.
Exceptions
SemaphoreExceptionif Synchronized object held no resource.

Referenced by corelinux::Synchronized::Guard::release().

void corelinux::CoreLinuxGuardPool::releaseSynchronized ( SynchronizedPtr  aPtr)
throw (SemaphoreException
)
protected

releaseSynchronized manages the associations of objects to the semaphore in the pool when releasing a guard.

Parameters
Synchronizedpointer of guard owner.

References corelinux::PoolDescriptor::theQueueLength.

static void corelinux::CoreLinuxGuardPool::setExtentSize ( Short  aExtentSize)
throw (Assertion
)
static

Run time interface for changing the extent size.

The next time the pool goes into extent processing, this will be used.

Parameters
shortthe new extent size
Exceptions
Assertionif size < 0

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

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium