#include <MutexSemaphore.hpp>
Public Member Functions | |
MutexSemaphore (SemaphoreGroupPtr, SemaphoreIdentifierRef, bool AutoLock=false, bool Recursive=true, bool Balking=false) throw ( NullPointerException ) | |
Default constructor requires the identifier of the semaphore in the semaphore group. | |
virtual | ~MutexSemaphore (void) |
Virtual Destructor. | |
virtual bool | isLocked (void) |
Ask if semaphore instance is locked. | |
virtual SemaphoreOperationStatus | lockWithWait (void) throw (SemaphoreException) |
Request the semaphore, wait for availability. | |
virtual SemaphoreOperationStatus | lockWithNoWait (void) throw (SemaphoreException) |
Request the semaphore without waiting. | |
virtual SemaphoreOperationStatus | release (void) throw (SemaphoreException) |
Request the semaphore but timeout if not available. | |
Protected Member Functions | |
MutexSemaphore (void) throw ( Assertion ) | |
Default construct throws assert. | |
MutexSemaphore (MutexSemaphoreCref) throw ( Assertion ) | |
Copy constructor throws assertion. | |
MutexSemaphoreRef | operator= (MutexSemaphoreCref) throw ( Assertion ) |
Assignment operator throws assertion. |
The semantics for Recursion: The thread that is successful is obtaining the lock will be regarded as theOwningThreadIdentifier. If, upon a lock request, it is determined that the same thread that owns the lock is asking to lock again, theRecursionQueueLength will be incremented. It is thereafter neccessary for theOwningThread to release the semaphore until theRecursionQueueLength returns to zero (0). All other callers will block or not based on their lock call disposition.
corelinux::MutexSemaphore::MutexSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
SemaphoreIdentifierRef | aIdentifier, | |||
bool | AutoLock = false , |
|||
bool | Recursive = true , |
|||
bool | Balking = false | |||
) | throw ( NullPointerException ) |
Default constructor requires the identifier of the semaphore in the semaphore group.
SemaphoreGroup | pointer to the owning SemaphoreGroup | |
SemaphoreIdentifier | The identifier for the Semaphore from the SemaphoreGroup | |
bool | true if autolock on creation | |
bool | true if recursion enabled | |
bool | true if balking enabled |
References lockWithWait(), corelinux::Semaphore::setOwnerId(), and corelinux::AbstractSemaphore::setValue().
SemaphoreOperationStatus corelinux::MutexSemaphore::release | ( | void | ) | throw (SemaphoreException) [virtual] |
Request the semaphore but timeout if not available.
Release the semaphore if owner
Implements corelinux::AbstractSemaphore.
References corelinux::Semaphore::getOwnerId(), corelinux::Semaphore::getRecursionQueueLength(), corelinux::Thread::getThreadIdentifier(), corelinux::Semaphore::resetOwnerId(), corelinux::AbstractSemaphore::setUnlock(), corelinux::SUCCESS, and corelinux::UNAVAILABLE.