corelinux_MutexSemaphoreGroup3
A mutexsemaphoregroup is an extension to the semaphoregroup for creating only mutexsemaphore types.
Usage
Inherits corelinux::SemaphoreGroup.
Public Member Functions
MutexSemaphoreGroup (Short,
Int
Rights=OWNER_ALL)
throw
(Assertion,SemaphoreException)
Default constructor
creates
a
private
group
semaphores
with
access
for
OWNER_ALL.
MutexSemaphoreGroup
(Short,
SemaphoreGroupIdentifierCref,
Int,
CreateDisposition
disp=FAIL_IF_EXISTS)
throw
(Assertion,SemaphoreException)
Create a
default
MutexSemaphore.
virtual
AbstractSemaphorePtr
createLockedSemaphore
(bool
Recursive=false,
bool
Balking=false)
throw
(
SemaphoreException
)
Create a
locked
MutexSemaphore.
virtual
AbstractSemaphorePtr
createSemaphore
(SemaphoreIdentifierRef
aIdentifier,
CreateDisposition
disp=CREATE_OR_REUSE,
bool
Recursive=false,
bool
Balking=false)
throw
(
SemaphoreException
)
Create or
open
(use)
a
specific
MutexSemphore.
virtual
AbstractSemaphorePtr
createLockedSemaphore
(SemaphoreIdentifierRef
aIdentifier,
CreateDisposition
disp=CREATE_OR_REUSE,
bool
Recursive=false,
bool
Balking=false)
throw
(
SemaphoreException
)
Create or
open
(use)
a
specific
MutexSemphore.
virtual
void
destroySemaphore
(AbstractSemaphorePtr)
throw
(
SemaphoreException
)
Destroys a
created
MutexSemaphore.
Protected Member Functions
MutexSemaphoreGroup (void)
throw
(
Assertion
)
Detailed Description
A MutexSemaphoreGroup is an extension to the SemaphoreGroup for creating only MutexSemaphore types.
Default behavior for creating semaphores via the SemaphoreGroup interface is to NOT autolock the MutexSemaphore. Use the createLockedSemaphore(...) interface to accomplish this.
Constructor & Destructor Documentation
corelinux::MutexSemaphoreGroup::MutexSemaphoreGroup (Short, Int Rights = OWNER_ALL) throw (Assertion,SemaphoreException)
Default constructor creates a private group semaphores with access for OWNER_ALL. Parameters:
Short Number of semaphores in group
AccessRights Specifies access control for group
Exceptions:
Assertion if aCount < 1
SemaphoreException if kernel group create call fails.
See also:
AccessRights
corelinux::MutexSemaphoreGroup::MutexSemaphoreGroup (Short, SemaphoreGroupIdentifierCref, Int, CreateDisposition disp = FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
Constructor to open or create a semaphore group with a specific identifier. Parameters:
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
Exceptions:
Assertion if aCount < 1
SemaphoreException for described states
corelinux::MutexSemaphoreGroup::MutexSemaphoreGroup (Short, CharCptr, Int, CreateDisposition disp = FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
Constructor to open or create a semaphore group by name. Parameters:
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
Exceptions:
Assertion if aCount < 1 or aCount > system defined maximum for group
SemaphoreException for described states
Member Function Documentation
AbstractSemaphorePtr corelinux::MutexSemaphoreGroup::createLockedSemaphore (SemaphoreIdentifierRef aIdentifier, CreateDisposition disp = CREATE_OR_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException ) [virtual]
Create or open (use) a specific MutexSemphore and have it automatically locked. Parameters:
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
Returns:
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions:
SemaphoreException if the disposition disagrees with the semaphore state, or if it is a erroneous identifier
AbstractSemaphorePtr corelinux::MutexSemaphoreGroup::createLockedSemaphore (bool Recursive = false, bool Balking = false) throw ( SemaphoreException ) [virtual]
Create a locked MutexSemaphore. Returns:
AbstractSemaphore aSem - pointer to created semaphore
Exceptions:
SemaphoreException if no sems left in group
AbstractSemaphorePtr corelinux::MutexSemaphoreGroup::createSemaphore (std::string aName, CreateDisposition disp = CREATE_OR_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException ) [virtual]
Create or open (use) a specific MutexSemphore. Parameters:
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
Returns:
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions:
SemaphoreException if the disposition disagrees with the semaphore state, or if it is a erroneous identifier
Implements corelinux::SemaphoreGroup.
AbstractSemaphorePtr corelinux::MutexSemaphoreGroup::createSemaphore (SemaphoreIdentifierRef aIdentifier, CreateDisposition disp = CREATE_OR_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException ) [virtual]
Create or open (use) a specific MutexSemphore. Parameters:
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
Returns:
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions:
SemaphoreException if the disposition disagrees with the semaphore state, or if it is a erroneous identifier
Implements corelinux::SemaphoreGroup.
AbstractSemaphorePtr corelinux::MutexSemaphoreGroup::createSemaphore (void) throw ( SemaphoreException ) [virtual]
Create a default MutexSemaphore. Returns:
AbstractSemaphore aSem - pointer to created semaphore
Exceptions:
SemaphoreException if no sems left in group
Implements corelinux::SemaphoreGroup.
void corelinux::MutexSemaphoreGroup::destroySemaphore (AbstractSemaphorePtr) throw ( SemaphoreException ) [virtual]
Destroys a created MutexSemaphore. Note:
Reference counting is not enabled so applications should ensure that only one (1) destroy is called per semaphore.
Parameters:
AbstractSemaphore pointer of semaphore to destroy
Exceptions:
SemaphoreException if semaphore does not belong to this group or if already destroyed.
Implements corelinux::SemaphoreGroup.
History
- Debian 3.1 (Sarge): the text shown here
- Debian 3.0 (Woody)