GatewaySemaphore.hpp
#if !defined(__GATEWAYSEMAPHORE_HPP)
#define __GATEWAYSEMAPHORE_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(__SEMAPHORE_HPP)
#include <Semaphore.hpp>
#endif
#if !defined(__MAP_HPP)
#include <Map.hpp>
#endif
namespace corelinux
{
DECLARE_CLASS( GatewaySemaphore );
CORELINUX_MAP
(
ThreadIdentifier,
Count ,
std::less<ThreadIdentifier>,
GatewayClient
);
class GatewaySemaphore : public Semaphore
{
public:
//
// Constructors and destructors
//
GatewaySemaphore
(
SemaphoreGroupPtr,
SemaphoreIdentifierRef,
Count ,
bool Recursive = false,
bool Balking = false
) throw ( NullPointerException );
virtual ~GatewaySemaphore( void );
//
// Accessors
//
virtual bool isLocked( void );
virtual bool isAnOwner( void );
virtual Counter getOwnerRecursionQueueLength( void );
//
// Mutators
//
virtual SemaphoreOperationStatus lockWithWait(void)
throw( SemaphoreException );
virtual SemaphoreOperationStatus lockWithNoWait(void)
throw( SemaphoreException );
// virtual SemaphoreOperationStatus lockWithTimeOut( Timer )
// throw(SemaphoreException) = 0;
virtual SemaphoreOperationStatus release(void)
throw( SemaphoreException );
protected:
//
// Constructors
//
GatewaySemaphore( void ) throw( Assertion );
GatewaySemaphore( GatewaySemaphoreCref )
throw( Assertion );
//
// Operator overloads
//
GatewaySemaphoreRef operator=( GatewaySemaphoreCref )
throw( Assertion );
//
// Mutators
//
SemaphoreOperationStatus lockAndAdd
(
ThreadIdentifierRef aTid,
Int aFlag = 0
);
private:
Count theMaxCount;
GatewayClient theClients;
};
}
#endif // if !defined(__GATEWAYSEMAPHORE_HPP)
/*
Common rcs information do not modify
$Author: prudhomm $
$Revision: 1.4 $
$Date: 2000/08/31 22:52:20 $
$Locker: $
*/
corelinux::GatewaySemaphore::getOwnerRecursionQueueLength
virtual Counter getOwnerRecursionQueueLength(void)
Returns the recursion depth for the calling thread.
Definition: GatewaySemaphore.cpp:134
corelinux::GatewaySemaphore::isAnOwner
virtual bool isAnOwner(void)
Returns true if calling thread owns a resource.
Definition: GatewaySemaphore.cpp:105
corelinux::GatewaySemaphore::GatewaySemaphore
GatewaySemaphore(void)
Default construct throws assert.
Definition: GatewaySemaphore.cpp:39
corelinux::GatewaySemaphore::~GatewaySemaphore
virtual ~GatewaySemaphore(void)
Virtual Destructor.
Definition: GatewaySemaphore.cpp:86
corelinux::GatewaySemaphore
GatewaySemphore enables a depth of resource indicator.
Definition: GatewaySemaphore.hpp:72
corelinux::GatewaySemaphore::isLocked
virtual bool isLocked(void)
Ask if AbstractSemaphore instance is locked.
Definition: GatewaySemaphore.cpp:95
corelinux::SemaphoreOperationStatus
SemaphoreOperationStatus
Semaphore method return enumeration.
Definition: AbstractSemaphore.hpp:39
corelinux::NullPointerException
NullPointerException is the base exception type for NullPointer.
Definition: NullPointerException.hpp:40
corelinux::ScalarIdentifier
ScalarIdentifier provides a templated interface for declaring CoreLinux Identifiers for simple scalar...
Definition: ScalarIdentifiers.hpp:37
corelinux::SemaphoreException
SemaphoreException is the base exception type for Semaphore.
Definition: SemaphoreException.hpp:39
corelinux::Semaphore
A Semaphore supports the protocol that processes and/or threads agree to follow for the purpose of co...
Definition: Semaphore.hpp:61
corelinux::Assertion
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
corelinux::GatewaySemaphore::release
virtual SemaphoreOperationStatus release(void)
Request the AbstractSemaphore but timeout if not available.
Definition: GatewaySemaphore.cpp:409
corelinux::GatewaySemaphore::lockWithWait
virtual SemaphoreOperationStatus lockWithWait(void)
Request the lock, wait for availability.
Definition: GatewaySemaphore.cpp:155
corelinux::GatewaySemaphore::lockWithNoWait
virtual SemaphoreOperationStatus lockWithNoWait(void)
Request the lock without waiting.
Definition: GatewaySemaphore.cpp:282
corelinux::SemaphoreGroup
A SemaphoreGroup is an extension to the Linux semaphore set.
Definition: SemaphoreGroup.hpp:62
corelinux::GatewaySemaphore::operator=
GatewaySemaphoreRef operator=(GatewaySemaphoreCref)
Assignment operator throws assertion.

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