CoreLinux++
0.4.32
|
A AbstractSemaphore supports the protocol that processes and/or threads agree to follow for the purpose of controlled access to a resource. More...
#include <AbstractSemaphore.hpp>
Public Member Functions | |
AbstractSemaphore (SemaphoreGroupPtr, SemaphoreIdentifierRef) throw ( NullPointerException ) | |
Default constructor. | |
virtual | ~AbstractSemaphore (void) |
Virtual Destructor. | |
bool | operator== (AbstractSemaphoreCref aRef) const |
Equality operator returns true if identifiers match. | |
virtual bool | isBalkingEnabled (void) const =0 |
Returns true if balking enabled. | |
virtual bool | isRecursionEnabled (void) const =0 |
Returns true if recursion allowed. | |
SemaphoreIdentifierCref | getIdentifier (void) const |
Return a reference to this AbstractSemaphore identifier. | |
SemaphoreGroupIdentifierCref | getGroupIdentifier (void) const |
Returns a reference to the SemaphoreGroup identifier. | |
virtual ThreadIdentifierCref | getOwningThreadIdentifier (void) const =0 |
Returns the identifier of who currently owns the semaphore. | |
virtual CounterCref | getRecursionQueueLength (void) const =0 |
Return the depth of the recursion for the owner. | |
Int | getValue (void) |
Returns the current value of the semaphore. | |
Int | getInitialValue (void) |
Retrieves the initial value for a semaphore. | |
virtual bool | isLocked (void)=0 |
Ask if AbstractSemaphore instance is locked. | |
virtual SemaphoreOperationStatus | lockWithWait (void)=0 throw (SemaphoreException) |
Request the lock, wait for availability. | |
virtual SemaphoreOperationStatus | lockWithNoWait (void)=0 throw (SemaphoreException) |
Request the lock without waiting. | |
virtual SemaphoreOperationStatus | release (void)=0 throw (SemaphoreException) |
Request the AbstractSemaphore but timeout if not available. More... | |
![]() | |
Synchronized (void) | |
Default constructor. | |
Synchronized (SynchronizedCref) | |
Copy constructor. | |
virtual | ~Synchronized (void) |
Virtual Destructor. | |
SynchronizedRef | operator= (SynchronizedCref) |
Assignment operator. | |
bool | operator== (SynchronizedCref) const |
Equality operator. | |
Protected Member Functions | |
AbstractSemaphore (AbstractSemaphoreCref) throw (Assertion) | |
AbstractSemaphoreRef | operator= (AbstractSemaphoreCref) throw (Assertion) |
SemaphoreIdentifierRef | getId (void) |
Returns a reference to the AbstractSemaphore identifier. | |
Int | getGroupId (void) const |
Returns a reference to the group identifier. | |
virtual ThreadIdentifierRef | getOwnerId (void)=0 |
Returns a reference to the owning thread. | |
SemaphoreOperationStatus | setLock (Int) |
Calls kernel lock mechanism. | |
SemaphoreOperationStatus | setUnlock (Int) |
Calls kernel unlock mechanism. | |
SemaphoreOperationStatus | waitZero (Int) |
Calls kernel zero mechanism. | |
SemaphoreOperationStatus | setValue (Int) |
Sets the value for the AbstractSemaphore. | |
![]() | |
Guard | access (void) const throw (SemaphoreException) |
Access returns a instance of Guard which is block scoped to the caller. More... | |
Additional Inherited Members | |
![]() | |
typedef Guard * | GuardPtr |
typedef const Guard * | GuardCptr |
typedef Guard & | GuardRef |
typedef const Guard & | GuardCref |
A AbstractSemaphore supports the protocol that processes and/or threads agree to follow for the purpose of controlled access to a resource.
The resource can be anything that the developer considers to need access controls on such as memory, hardware, methods, computer instructions, and so on.
Callers can elect to avoid being put into a blocked state and return immediately without control to the resource. Callers may also request that they are put into a blocked state for a specified amount of time. If, at the end of the specified time, the request has not been satisfied, it is returned with a Timeout indicator.
The owner or creator of the AbstractSemaphore can elect to enforce balking behavior on a AbstractSemaphore. When so designated, the AbstractSemaphore can turn back any request until some condition in their solution space is met regardless of the callers blocking options. If a caller access attempt is balked, is it returned with a Balked indicator.
|
pure virtual |
Request the AbstractSemaphore but timeout if not available.
Release the lock
Implemented in corelinux::GatewaySemaphore, corelinux::EventSemaphore, corelinux::MutexSemaphore, and corelinux::GuardSemaphore.
Referenced by corelinux::CoreLinuxGuardPool::lockSynchronized().