#include <GatewaySemaphore.hpp>

Public Member Functions | |
| 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. | |
| virtual | ~GatewaySemaphore (void) |
| Virtual Destructor. | |
| virtual bool | isLocked (void) |
| Ask if AbstractSemaphore instance is locked. | |
| virtual bool | isAnOwner (void) |
| Returns true if calling thread owns a resource. | |
| virtual Counter | getOwnerRecursionQueueLength (void) |
| Returns the recursion depth for the calling thread. | |
| virtual SemaphoreOperationStatus | lockWithWait (void) throw ( SemaphoreException ) |
| Request the lock, wait for availability. | |
| virtual SemaphoreOperationStatus | lockWithNoWait (void) throw ( SemaphoreException ) |
| Request the lock without waiting. | |
| virtual SemaphoreOperationStatus | release (void) throw ( SemaphoreException ) |
| Request the AbstractSemaphore but timeout if not available. | |
Protected Member Functions | |
| GatewaySemaphore (void) throw ( Assertion ) | |
| Default construct throws assert. | |
| GatewaySemaphore (GatewaySemaphoreCref) throw ( Assertion ) | |
| Copy constructor throws assertion. | |
| GatewaySemaphoreRef | operator= (GatewaySemaphoreCref) throw ( Assertion ) |
| Assignment operator throws assertion. | |
| SemaphoreOperationStatus | lockAndAdd (ThreadIdentifierRef aTid, Int aFlag=0) |
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:
| corelinux::GatewaySemaphore::GatewaySemaphore | ( | SemaphoreGroupPtr | aGroup, | |
| SemaphoreIdentifierRef | aIdentifier, | |||
| Count | aValue, | |||
| 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.
| 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 |
References corelinux::AbstractSemaphore::setValue().
| Counter corelinux::GatewaySemaphore::getOwnerRecursionQueueLength | ( | void | ) | [virtual] |
Returns the recursion depth for the calling thread.
References corelinux::Thread::getThreadIdentifier(), and isAnOwner().
| SemaphoreOperationStatus corelinux::GatewaySemaphore::release | ( | void | ) | throw ( SemaphoreException ) [virtual] |
Request the AbstractSemaphore but timeout if not available.
Release the lock
Implements corelinux::AbstractSemaphore.
References corelinux::Semaphore::getOwnerId(), corelinux::Thread::getThreadIdentifier(), corelinux::Semaphore::isRecursionEnabled(), corelinux::Semaphore::resetOwnerId(), corelinux::AbstractSemaphore::setUnlock(), corelinux::SUCCESS, and corelinux::UNAVAILABLE.