#include <EventSemaphore.hpp>
Public Member Functions | |
EventSemaphore (SemaphoreGroupPtr aGroup, SemaphoreIdentifierRef aIdentifier, Counter aLimit, bool aRecursionFlag=true, bool aBalkingFlag=false) throw ( NullPointerException ) | |
Default constructor requires the identifier of the semaphore in the semaphore group. | |
virtual | ~EventSemaphore (void) |
Virtual Destructor. | |
virtual bool | isLocked (void) |
Check if semaphore instance is locked. | |
SemaphoreOperationStatus | post (void) throw ( SemaphoreException ) |
Indicate owner commitment to trigger the event after a finite amount of time. | |
virtual SemaphoreOperationStatus | lockWithWait (void) throw ( SemaphoreException ) |
Wait for the event associated with this semaphore to take place. | |
virtual SemaphoreOperationStatus | lockWithNoWait (void) throw ( SemaphoreException ) |
Check if the associated event has taken place. | |
virtual SemaphoreOperationStatus | release (void) throw ( SemaphoreException ) |
Request the semaphore but timeout if not available. | |
virtual void | setLimit (Counter aLimit) throw ( SemaphoreException ) |
Set the maximum number of listeners allowed on this semaphore. | |
virtual Counter | getLimit (void) const |
Get the maximum number of listeners of this semaphore. | |
Protected Member Functions | |
EventSemaphore (void) throw ( Assertion ) | |
Default constructor throws assert. | |
EventSemaphore (EventSemaphoreCref) throw ( Assertion ) | |
Copy constructor throws assertion. | |
EventSemaphoreRef | operator= (EventSemaphoreCref) throw ( Assertion ) |
Assignment operator throws assertion. |
corelinux::EventSemaphore::EventSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
SemaphoreIdentifierRef | aIdentifier, | |||
Counter | aLimit, | |||
bool | aRecursionFlag = true , |
|||
bool | aBalkingFlag = false | |||
) | throw ( NullPointerException ) |
Default constructor requires the identifier of the semaphore in the semaphore group.
aGroup | pointer to the owning SemaphoreGroup | |
aIdentifier | The identifier for the Semaphore from the SemaphoreGroup | |
aLimit | the maximum number of listeners.
| |
Recursive | true if recursion enabled | |
Balking | true if balking enabled |
References corelinux::Semaphore::setOwnerId(), and corelinux::AbstractSemaphore::setValue().
SemaphoreOperationStatus corelinux::EventSemaphore::lockWithWait | ( | void | ) | throw ( SemaphoreException ) [virtual] |
Wait for the event associated with this semaphore to take place.
Block if the event has not occured
Implements corelinux::AbstractSemaphore.
References corelinux::Synchronized::access(), corelinux::BALKED, corelinux::Semaphore::isBalkingEnabled(), isLocked(), corelinux::Synchronized::Guard::release(), corelinux::SUCCESS, corelinux::UNAVAILABLE, and corelinux::AbstractSemaphore::waitZero().
SemaphoreOperationStatus corelinux::EventSemaphore::release | ( | void | ) | throw ( SemaphoreException ) [virtual] |
Request the semaphore but timeout if not available.
Signal the observer that an event has occured.
Implements corelinux::AbstractSemaphore.
References corelinux::AbstractSemaphore::setLock(), and corelinux::SUCCESS.
void corelinux::EventSemaphore::setLimit | ( | Counter | aLimit | ) | throw ( SemaphoreException ) [virtual] |
Set the maximum number of listeners allowed on this semaphore.
aLimit | the maximum number of listeners.
|
References corelinux::Semaphore::getOwnerId(), and corelinux::Thread::getThreadIdentifier().