corelinux_GatewaySemaphore3
Gatewaysemphore enables a depth of resource indicator.
Usage
Inherits corelinux::Semaphore.
Public Member Functions
GatewaySemaphore (SemaphoreGroupPtr,
SemaphoreIdentifierRef,
Count,
bool
Recursive=false,
bool
Balking=false)
throw
(
NullPointerException
)
Virtual Destructor.
virtual
bool
isLocked
(void)
Protected Member Functions
GatewaySemaphore (void)
throw
(
Assertion
)
Detailed Description
GatewaySemphore enables a depth of resource indicator.
Unlike the tradition boolean semaphore (locked,unlocked), this type assumes a finite number of threads/processes can be granted access up to theResourceMaximum. The semantics regarding semaphore and recursion in relationship to the GatewaySemaphore is as follows:
With recursion enabled:
- •
-
Semaphore::getOwningThreadIdentifier returns the ThreadIdentifier of the thread that pushed the value to zero(0).
- •
-
Semaphore::getRecursionQueueLength returns the depth of recursion by Semaphore::getOwningThreadIdentifier
- •
-
GatewaySemaphore::isAnOwner returns true if the current thread is in the set of threads that own a resource.
- •
-
GatewaySemaphore::getOwnerRecursionQueueLength returns either -1 if the current thread does not control a resource, 0 if the current thread does own a resource, but has not recursed, or returns the depth of recursion for the calling thread.
Constructor & Destructor Documentation
corelinux::GatewaySemaphore::GatewaySemaphore (SemaphoreGroupPtr, SemaphoreIdentifierRef, Count, bool Recursive = false, bool Balking = false) throw ( NullPointerException )
Default constructor requires the identifier of the semaphore in the semaphore group and a count of resources for control. Parameters:
SemaphoreGroupPtr The owning SemaphoreGroup
SemaphoreIdentifier The identifier for the Semaphore from the SemaphoreGroup
Count number of resources the semaphore controls
bool true if recursion enabled
bool true if balking enabled
Member Function Documentation
Counter corelinux::GatewaySemaphore::getOwnerRecursionQueueLength (void) [virtual]
Returns the recursion depth for the calling thread. Returns:
Counter -1 if not an owner, 0 if owner but not recursed, or > 0 for recursion depth.
History
- Debian 3.1 (Sarge): the text shown here
- Debian 3.0 (Woody)