#include <SemaphoreGroup.hpp>
Inheritance diagram for corelinux::SemaphoreGroup:
Public Member Functions | |
SemaphoreGroup (Short, Int Rights=OWNER_ALL) throw (Assertion,SemaphoreException) | |
Default constructor creates a private group semaphores. | |
SemaphoreGroup (Short, SemaphoreGroupIdentifierCref, Int, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException) | |
Constructor to open or create a semaphore group with a specific identifier. | |
SemaphoreGroup (Short, CharCptr, Int, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException) | |
Constructor to open or create a semaphore group by name. | |
virtual | ~SemaphoreGroup (void) |
Virtual destructor. | |
bool | operator== (SemaphoreGroupCref) const |
Equality operator compares the identifier. | |
Short | getSemaphoreCount (void) const |
Return the number of semaphores in the group. | |
SemaphoreGroupIdentifierCref | getIdentifier (void) const |
Return the SemaphoreGroupIdentifier. | |
virtual AbstractSemaphorePtr | createSemaphore (void)=0 throw ( SemaphoreException ) |
Create a default semaphore type from group. | |
virtual AbstractSemaphorePtr | createSemaphore (SemaphoreIdentifierRef aIdentifier, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false)=0 throw ( SemaphoreException ) |
Create or open (use) a specific semphore in the group. | |
virtual AbstractSemaphorePtr | createSemaphore (std::string aName, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false)=0 throw ( SemaphoreException ) |
Create or open (use) a specific semphore in the group. | |
virtual void | destroySemaphore (AbstractSemaphorePtr)=0 throw ( SemaphoreException ) |
Destroys a created semaphore from this group. | |
Protected Member Functions | |
SemaphoreGroup (void) throw ( Assertion ) | |
Default constructor not allowed. | |
SemaphoreGroup (SemaphoreGroupCref) throw ( Assertion ) | |
Copy constructor not allowed. | |
SemaphoreGroupRef | operator= (SemaphoreGroupCref) throw ( Assertion ) |
Assignment operator not allowed. | |
void | setGroupType (IntCref) const |
This indirects to CSA for non-private group types. | |
bool | isPrivate (void) const |
Internal check for creation visibility. | |
Friends | |
class | SemaphoreCommon |
This provides a way to logically group semaphores. A SemaphoreGroup acts as a Semaphore factory, creating and destroying Semaphores for the user.
corelinux::SemaphoreGroup::SemaphoreGroup | ( | Short | , | |
Int | Rights = OWNER_ALL | |||
) | throw (Assertion,SemaphoreException) |
Default constructor creates a private group semaphores.
Short | Number of semaphores in group | |
AccessRights | Specifies access control for group, default is owner only. |
Assertion | if aCount < 1 | |
SemaphoreException | if kernel group create call fails. |
corelinux::SemaphoreGroup::SemaphoreGroup | ( | Short | , | |
SemaphoreGroupIdentifierCref | , | |||
Int | , | |||
CreateDisposition | disp = FAIL_IF_EXISTS | |||
) | throw (Assertion,SemaphoreException) |
Constructor to open or create a semaphore group with a specific identifier.
Short | Number of semaphores in group, this only has meaning used if failOnExist = true | |
SemaphoreGroupIdentifier | valid group identifier either through a system call or via another ipc mechanism | |
AccessRights | Specifies access control for group | |
CreateDisposition | indicates how to treat the conditions that the group may meet in the request: CREATE_OR_REUSE indicates that the caller doesn't care FAIL_IF_EXISTS indicates the attempt was for a create FAIL_IF_NOTEXISTS indicates the attempt was for a open |
Assertion | if aCount < 1 | |
SemaphoreException | for described states |
corelinux::SemaphoreGroup::SemaphoreGroup | ( | Short | , | |
CharCptr | , | |||
Int | , | |||
CreateDisposition | disp = FAIL_IF_EXISTS | |||
) | throw (Assertion,SemaphoreException) |
Constructor to open or create a semaphore group by name.
Short | Number of semaphores in group, this only has meaning used if failOnExist = true | |
Char | pointer to Group name | |
AccessRights | Specifies access control for group | |
CreateDisposition | indicates how to treat the conditions that the group may meet in the request: CREATE_OR_REUSE indicates that the caller doesn't care FAIL_IF_EXISTS indicates the attempt was for a create FAIL_IF_NOTEXISTS indicates the attempt was for a open |
Assertion | if aCount < 1 or aCount > system defined maximum for group | |
SemaphoreException | for described states |
bool corelinux::SemaphoreGroup::operator== | ( | SemaphoreGroupCref | ) | const |
Equality operator compares the identifier.
SemaphoreGroup | a reference to SemaphoreGroup |
Short corelinux::SemaphoreGroup::getSemaphoreCount | ( | void | ) | const |
Return the number of semaphores in the group.
SemaphoreGroupIdentifierCref corelinux::SemaphoreGroup::getIdentifier | ( | void | ) | const [inline] |
Return the SemaphoreGroupIdentifier.
virtual AbstractSemaphorePtr corelinux::SemaphoreGroup::createSemaphore | ( | void | ) | throw ( SemaphoreException ) [pure virtual] |
Create a default semaphore type from group.
SemaphoreException | if no sems left in group |
Implemented in corelinux::CoreLinuxGuardGroup, corelinux::EventSemaphoreGroup, corelinux::GatewaySemaphoreGroup, and corelinux::MutexSemaphoreGroup.
virtual AbstractSemaphorePtr corelinux::SemaphoreGroup::createSemaphore | ( | SemaphoreIdentifierRef | aIdentifier, | |
CreateDisposition | disp = CREATE_OR_REUSE , |
|||
bool | Recursive = false , |
|||
bool | Balking = false | |||
) | throw ( SemaphoreException ) [pure virtual] |
Create or open (use) a specific semphore in the group.
SemaphoreIdentifier | identifies which semphore id to create or attempt to use | |
CreateDisposition | indicates how to treat the conditions that the group may meet in the request: CREATE_OR_REUSE indicates that the caller doesn't care FAIL_IF_EXISTS indicates the attempt was for a create FAIL_IF_NOTEXISTS indicates the attempt was for a open | |
Recursive | to allow same thread multiple locks | |
Balking | to allow the semaphore to balk |
SemaphoreException | if the disposition disagrees with the semaphore state, or if it is a erroneous identifier |
Implemented in corelinux::CoreLinuxGuardGroup, corelinux::EventSemaphoreGroup, corelinux::GatewaySemaphoreGroup, and corelinux::MutexSemaphoreGroup.
virtual AbstractSemaphorePtr corelinux::SemaphoreGroup::createSemaphore | ( | std::string | aName, | |
CreateDisposition | disp = CREATE_OR_REUSE , |
|||
bool | Recursive = false , |
|||
bool | Balking = false | |||
) | throw ( SemaphoreException ) [pure virtual] |
Create or open (use) a specific semphore in the group.
string | identifies which semphore id to create or attempt to use | |
CreateDisposition | indicates how to treat the conditions that the group may meet in the request: CREATE_OR_REUSE indicates that the caller doesn't care FAIL_IF_EXISTS indicates the attempt was for a create FAIL_IF_NOTEXISTS indicates the attempt was for a open | |
Recursive | to allow same thread multiple locks | |
Balking | to allow the semaphore to balk |
SemaphoreException | if the disposition disagrees with the semaphore state, or if it is a erroneous identifier |
Implemented in corelinux::CoreLinuxGuardGroup, corelinux::EventSemaphoreGroup, corelinux::GatewaySemaphoreGroup, and corelinux::MutexSemaphoreGroup.
virtual void corelinux::SemaphoreGroup::destroySemaphore | ( | AbstractSemaphorePtr | ) | throw ( SemaphoreException ) [pure virtual] |
Destroys a created semaphore from this group.
AbstractSemaphore | pointer of semaphore to destroy |
SemaphoreException | if semaphore does not belong to this group |
Implemented in corelinux::CoreLinuxGuardGroup, corelinux::EventSemaphoreGroup, corelinux::GatewaySemaphoreGroup, and corelinux::MutexSemaphoreGroup.
void corelinux::SemaphoreGroup::setGroupType | ( | IntCref | ) | const [protected] |
This indirects to CSA for non-private group types.
Int | reference to type where 0 = Mutex, 1 = Gateway, 2 = Event, 3-10 reserved. Anything greater than 10 is user defined. |
bool corelinux::SemaphoreGroup::isPrivate | ( | void | ) | const [inline, protected] |
Internal check for creation visibility.
This implies that even though the group may be shared, the user has elected to use privately.