CoreLinux++  0.4.32
Public Member Functions | Protected Member Functions | List of all members
corelinux::EventSemaphoreGroup Class Reference

A EventSemaphoreGroup is an extension to the SemaphoreGroup for creating only EventSemaphore types. More...

#include <EventSemaphoreGroup.hpp>

Public Member Functions

 EventSemaphoreGroup (Short aSemCount, Int aRightSet=OWNER_ALL) throw (Assertion,SemaphoreException)
 Default constructor creates a private group semaphores with access for OWNER_ALL. More...
 
 EventSemaphoreGroup (Short aSemCount, SemaphoreGroupIdentifierCref aGID, Int aRightSet, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
 Constructor to open or create a semaphore group with a specific identifier. More...
 
 EventSemaphoreGroup (Short aSemCount, CharCptr aName, Int aRightSet, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
 Constructor to open or create a semaphore group by name. More...
 
virtual ~EventSemaphoreGroup (void)
 Virtual destructor.
 
virtual AbstractSemaphorePtr createSemaphore (void) throw ( SemaphoreException )
 Create a default EventSemaphore. More...
 
virtual AbstractSemaphorePtr createSemaphore (Counter aLimit) throw ( SemaphoreException )
 Create an EventSemaphore and set the maximum number of listeners allowed on this semaphore. More...
 
virtual AbstractSemaphorePtr createSemaphore (SemaphoreIdentifierRef aIdentifier, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false) throw ( SemaphoreException )
 Create or open (use) a specific EventSemphore. More...
 
virtual AbstractSemaphorePtr createSemaphore (SemaphoreIdentifierRef aIdentifier, Counter aLimit, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false) throw ( SemaphoreException )
 Create or open (use) a specific EventSemphore and set the maximum number of listeners to the specified count. More...
 
virtual AbstractSemaphorePtr createSemaphore (std::string aName, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false) throw ( SemaphoreException )
 Create or open (use) a specific EventSemaphore identified by its name. More...
 
virtual AbstractSemaphorePtr createSemaphore (std::string aName, Counter aLimit, CreateDisposition disp=CREATE_OR_REUSE, bool Recursive=false, bool Balking=false) throw ( SemaphoreException )
 Create or open (use) a specific EventSemaphore. More...
 
virtual void destroySemaphore (AbstractSemaphorePtr aPtr) throw ( SemaphoreException )
 Destroys a previously created EventSemaphore. More...
 
- Public Member Functions inherited from corelinux::SemaphoreGroup
 SemaphoreGroup (Short, Int Rights=OWNER_ALL) throw (Assertion,SemaphoreException)
 Default constructor creates a private group semaphores. More...
 
 SemaphoreGroup (Short, SemaphoreGroupIdentifierCref, Int, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
 Constructor to open or create a semaphore group with a specific identifier. More...
 
 SemaphoreGroup (Short, CharCptr, Int, CreateDisposition disp=FAIL_IF_EXISTS) throw (Assertion,SemaphoreException)
 Constructor to open or create a semaphore group by name. More...
 
virtual ~SemaphoreGroup (void)
 Virtual destructor.
 
bool operator== (SemaphoreGroupCref) const
 Equality operator compares the identifier. More...
 
Short getSemaphoreCount (void) const
 Return the number of semaphores in the group. More...
 
SemaphoreGroupIdentifierCref getIdentifier (void) const
 Return the SemaphoreGroupIdentifier. 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

 EventSemaphoreGroup (void) throw ( Assertion )
 Default constructor not allowed.
 
 EventSemaphoreGroup (EventSemaphoreGroupCref) throw ( Assertion )
 Copy constructor not allowed.
 
EventSemaphoreGroupRef operator= (EventSemaphoreGroupCref) throw ( Assertion )
 
AbstractSemaphorePtr resolveSemaphore (SemaphoreIdentifierRef aIdentifier, Short aSemId, CreateDisposition aDisp, bool aRecurse, bool aBalk, Counter aMaxValue=1) throw ( SemaphoreException )
 
- Protected Member Functions inherited from corelinux::SemaphoreGroup
 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. More...
 
bool isPrivate (void) const
 Claim an unused semaphore from the group. More...
 
- 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 EventSemaphoreGroup is an extension to the SemaphoreGroup for creating only EventSemaphore types.

Default behavior for creating semaphores via the SemaphoreGroup interface is to create a Event and autolock it. There is no option for not autolocking it.

Constructor & Destructor Documentation

§ EventSemaphoreGroup() [1/3]

corelinux::EventSemaphoreGroup::EventSemaphoreGroup ( Short  aSemCount,
Int  aRightSet = OWNER_ALL 
)
throw (Assertion,
SemaphoreException
)

Default constructor creates a private group semaphores with access for OWNER_ALL.

Maximum limit of listeners will be set to "infinity"

Parameters
aSemCountNumber of semaphores in group
aRightSetaccess control for group
Exceptions
Assertionif aSemCount < 1
SemaphoreExceptionif kernel group create call fails.
See also
AccessRights

References EventSemaphoreGroup().

§ EventSemaphoreGroup() [2/3]

corelinux::EventSemaphoreGroup::EventSemaphoreGroup ( Short  aSemCount,
SemaphoreGroupIdentifierCref  aGID,
Int  aRightSet,
CreateDisposition  disp = FAIL_IF_EXISTS 
)
throw (Assertion,
SemaphoreException
)

Constructor to open or create a semaphore group with a specific identifier.

Maximum limit of listeners will be set to "infinity".

Parameters
aSemCountNumber of semaphores in group, this only has meaning used if failOnExist = true
aGIDvalid group identifier either through a system call or via another ipc mechanism
aRightSetSpecifies access control for group
distindicates 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
Assertionif aCount < 1
SemaphoreExceptionfor described states

References EventSemaphoreGroup().

§ EventSemaphoreGroup() [3/3]

corelinux::EventSemaphoreGroup::EventSemaphoreGroup ( Short  aSemCount,
CharCptr  aName,
Int  aRightSet,
CreateDisposition  disp = FAIL_IF_EXISTS 
)
throw (Assertion,
SemaphoreException
)

Constructor to open or create a semaphore group by name.

Maximum limit of listeners is set to "infinity"

Parameters
aSemCountShort Number of semaphores in group, this only has meaning used if failOnExist = true
aNamepointer to Group name
aRightSetspecifies access control for group
dispindicates 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
Assertionif aCount < 1 or aCount > system defined maximum for group
SemaphoreExceptionfor described states

Member Function Documentation

§ createSemaphore() [1/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( void  )
throw (SemaphoreException
)
virtual

Create a default EventSemaphore.

Returns
AbstractSemaphore aSem - pointer to created semaphore
Exceptions
SemaphoreExceptionif no sems left in group

Implements corelinux::SemaphoreGroup.

References corelinux::DEFAULT_COUNT(), and corelinux::FAIL_IF_EXISTS.

Referenced by createSemaphore().

§ createSemaphore() [2/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( Counter  aLimit)
throw (SemaphoreException
)
virtual

Create an EventSemaphore and set the maximum number of listeners allowed on this semaphore.

Parameters
aLimitmaximum number of listeners
Returns
AbstractSemaphore aSem - pointer to created semaphore
Exceptions
SemaphoreExceptionif no sems left in group

References createSemaphore(), and corelinux::FAIL_IF_EXISTS.

§ createSemaphore() [3/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( SemaphoreIdentifierRef  aIdentifier,
CreateDisposition  disp = CREATE_OR_REUSE,
bool  Recursive = false,
bool  Balking = false 
)
throw (SemaphoreException
)
virtual

Create or open (use) a specific EventSemphore.

Parameters
aIdentifieridentifies which semphore id to create or attempt to use
dispindicates 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
Recursiveto allow same thread multiple locks
Recursiveallow lock to recurse
Balkingto allow the semaphore to balk
Returns
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions
SemaphoreExceptionif the disposition disagrees with the semaphore state, or if it is a erroneous identifier

Implements corelinux::SemaphoreGroup.

References createSemaphore(), corelinux::DEFAULT_COUNT(), corelinux::ScalarIdentifier< ScalarType >::getScalar(), and corelinux::SemaphoreGroup::getSemaphoreCount().

§ createSemaphore() [4/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( SemaphoreIdentifierRef  aIdentifier,
Counter  aLimit,
CreateDisposition  disp = CREATE_OR_REUSE,
bool  Recursive = false,
bool  Balking = false 
)
throw (SemaphoreException
)
virtual

Create or open (use) a specific EventSemphore and set the maximum number of listeners to the specified count.

Parameters
aIdentifieridentifies which semphore id to create or attempt to use
aLimitmaximum number of listeners for EventSemaphore
dispindicates 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
Recursiveto allow same thread multiple locks
Balkingto allow the semaphore to balk
Returns
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions
SemaphoreExceptionif the disposition disagrees with the semaphore state, or if it is a erroneous identifier

References createSemaphore(), corelinux::ScalarIdentifier< ScalarType >::getScalar(), and corelinux::SemaphoreGroup::getSemaphoreCount().

§ createSemaphore() [5/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( std::string  aName,
CreateDisposition  disp = CREATE_OR_REUSE,
bool  Recursive = false,
bool  Balking = false 
)
throw (SemaphoreException
)
virtual

Create or open (use) a specific EventSemaphore identified by its name.

Parameters
aNameidentifies which semphore id to create or attempt to use
dispindicates 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
Recursiveto allow same thread multiple locks
Balkingto allow the semaphore to balk
Returns
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions
SemaphoreExceptionif the disposition disagrees with the semaphore state, or if it is a erroneous identifier

Implements corelinux::SemaphoreGroup.

References createSemaphore().

§ createSemaphore() [6/6]

AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore ( std::string  aName,
Counter  aLimit,
CreateDisposition  disp = CREATE_OR_REUSE,
bool  Recursive = false,
bool  Balking = false 
)
throw (SemaphoreException
)
virtual

Create or open (use) a specific EventSemaphore.

Parameters
aNameidentifies which semphore id to create or attempt to use
aLimitmaximum number of listeners for EventSemaphore
dispindicates 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
Recursiveto allow same thread multiple locks
Balkingto allow the semaphore to balk
Returns
AbstractSemaphore aSem - pointer to created or opened semaphore
Exceptions
SemaphoreExceptionif the disposition disagrees with the semaphore state, or if it is a erroneous identifier

§ destroySemaphore()

void corelinux::EventSemaphoreGroup::destroySemaphore ( AbstractSemaphorePtr  aPtr)
throw (SemaphoreException
)
virtual

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

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