CoreLinux++  0.4.32
Public Member Functions | Protected Member Functions | List of all members
corelinux::AbstractSemaphore Class Referenceabstract

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...
 
- Public Member Functions inherited from corelinux::Synchronized
 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

 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.
 
- Protected Member Functions inherited from corelinux::Synchronized
Guard access (void) const throw (SemaphoreException)
 Access returns a instance of Guard which is block scoped to the caller. More...
 

Additional Inherited Members

- Protected Types inherited from corelinux::Synchronized
typedef GuardGuardPtr
 
typedef const GuardGuardCptr
 
typedef GuardGuardRef
 
typedef const GuardGuardCref
 

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.

Member Function Documentation

virtual SemaphoreOperationStatus corelinux::AbstractSemaphore::release ( void  )
throw (SemaphoreException
)
pure virtual

The documentation for this class was generated from the following files:

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