CoreLinuxGuardPool.hpp
#if !defined(__CORELINUXGUARDPOOL_HPP)
#define __CORELINUXGUARDPOOL_HPP
/*
CoreLinux++
Copyright (C) 1999,2000 CoreLinux Consortium
The CoreLinux++ Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The CoreLinux++ Library Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined(__COMMON_HPP)
#include <Common.hpp>
#endif
#if !defined(__SINGLETON_HPP)
#include <Singleton.hpp>
#endif
#if !defined(__SEMAPHOREGROUP_HPP)
#include <SemaphoreGroup.hpp>
#endif
#if !defined(__VECTOR_HPP)
#include <Vector.hpp>
#endif
#if !defined(__MAP_HPP)
#include <Map.hpp>
#endif
namespace corelinux
{
struct PoolDescriptor
{
Count theQueueLength;
Index theGroupIndex;
};
CORELINUX_VECTOR
(
SemaphoreGroupPtr,
GroupVector
);
CORELINUX_MAP
(
AbstractSemaphorePtr,
PoolDescriptor,
std::less<AbstractSemaphorePtr>,
SemaphoreMap
);
CORELINUX_MAP
(
SynchronizedPtr,
AbstractSemaphorePtr,
std::less<SynchronizedPtr>,
MonitorMap
);
DECLARE_CLASS( CoreLinuxGuardPool );
DECLARE_TYPE( Singleton<CoreLinuxGuardPool>, GuardPool );
class CoreLinuxGuardPool
{
public:
//
// Constructors and destructor
//
CoreLinuxGuardPool( Short numInit=8, Short numExt=0 )
throw( Assertion );
virtual ~CoreLinuxGuardPool( void );
//
// Operator overloads
//
//
// Accessors
//
static bool isLocked( SynchronizedPtr ) throw( SemaphoreException );
static Short getInitialPoolSize( void );
static Short getExtentSize( void );
static Short getTotalCurrentSize( void );
//
// Mutators
//
static void lock( SynchronizedPtr ) throw( SemaphoreException );
static void release( SynchronizedPtr ) throw( SemaphoreException );
static void setExtentSize( Short aExtentSize ) throw( Assertion );
protected:
//
// Accessors
//
bool isSynchronizedLocked( SynchronizedPtr )
throw( SemaphoreException );
//
// Mutators
//
void lockSynchronized( SynchronizedPtr )
throw( SemaphoreException );
void releaseSynchronized( SynchronizedPtr )
throw( SemaphoreException );
void createPoolGroup( Short numSems, Short initSize=0 );
void destroyPoolGroup( Index aGroup );
protected:
static GuardPool theGuard;
static Short theInitialSize;
static Short theExtentSize;
private:
GroupVector theGroups;
SemaphoreMap theSemaphores;
MonitorMap theCallers;
AbstractSemaphorePtr theControlSem;
};
}
#endif // if !defined(__CORELINUXGUARDPOOL_HPP)
/*
Common rcs information do not modify
$Author: prudhomm $
$Revision: 1.3 $
$Date: 2000/08/31 22:52:20 $
$Locker: $
*/
corelinux::Singleton
Ensure a class only has one instance, and provide a global point of access to it. ...
Definition: Singleton.hpp:38
corelinux::CoreLinuxGuardPool::theInitialSize
static Short theInitialSize
Describes the inital pool size.
Definition: CoreLinuxGuardPool.hpp:255
corelinux::PoolDescriptor::theQueueLength
Count theQueueLength
The number of Synchronized concurrent request.
Definition: CoreLinuxGuardPool.hpp:59
corelinux::CoreLinuxGuardPool
The CoreLinuxGuardPool is a private SemaphoreGroup resource for class objects that require synchroniz...
Definition: CoreLinuxGuardPool.hpp:97
corelinux
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
corelinux::AbstractSemaphore
A AbstractSemaphore supports the protocol that processes and/or threads agree to follow for the purpo...
Definition: AbstractSemaphore.hpp:85
corelinux::PoolDescriptor::theGroupIndex
Index theGroupIndex
The SemaphoreGroup that this semaphore belongs to.
Definition: CoreLinuxGuardPool.hpp:63
corelinux::CoreLinuxGuardPool::theGuard
static GuardPool theGuard
Singleton instance.
Definition: CoreLinuxGuardPool.hpp:251
corelinux::CoreLinuxGuardPool::theExtentSize
static Short theExtentSize
Describes the size to add when going into extents.
Definition: CoreLinuxGuardPool.hpp:259
corelinux::SemaphoreException
SemaphoreException is the base exception type for Semaphore.
Definition: SemaphoreException.hpp:39
corelinux::Assertion
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
corelinux::Synchronized
Synchronized is a mixin which allows class objects to enable monitor functionality.
Definition: Synchronized.hpp:41
corelinux::PoolDescriptor
PoolDescriptor stores information about the ownership and usage of a semaphore in the pool...
Definition: CoreLinuxGuardPool.hpp:55
corelinux::SemaphoreGroup
A SemaphoreGroup is an extension to the Linux semaphore set.
Definition: SemaphoreGroup.hpp:62

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