Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

corelinux::AbstractSemaphore Class Reference

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>

Inheritance diagram for corelinux::AbstractSemaphore

Inheritance graph
[legend]
Collaboration diagram for corelinux::AbstractSemaphore:

Collaboration graph
[legend]
List of all members.

Public Methods

 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)
 Release the lock.


Protected Methods

 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 setValue ( Int )
 Sets the value for the AbstractSemaphore.


Detailed Description

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.


The documentation for this class was generated from the following files:
This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium