---
name: "corelinux_EventSemaphoreGroup"
section: "3"
platform: "linux"
package: "libcorelinux-dev"
version: "0.4.32-5"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/corelinux_EventSemaphoreGroup"
---

# corelinux\_EventSemaphoreGroup(3)

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

## NAME

corelinux::EventSemaphoreGroup - A **EventSemaphoreGroup** is an extension to the **SemaphoreGroup** for creating only **EventSemaphore** types.

## SYNOPSIS

`#include <EventSemaphoreGroup.hpp>`

Inherits **corelinux::SemaphoreGroup**.

### 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.*  **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.*  **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.*  virtual **~EventSemaphoreGroup** (void)\
 *Virtual destructor.*  virtual **AbstractSemaphorePtr** **createSemaphore** (void)  throw ( SemaphoreException )\
 *Create a default* **EventSemaphore***.*  virtual **AbstractSemaphorePtr** **createSemaphore** (Counter aLimit)  throw ( SemaphoreException )\
 *Create an* **EventSemaphore** *and set the maximum number of listeners allowed on this semaphore.*  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.*  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.*  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.*  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***.*  virtual void **destroySemaphore** (**AbstractSemaphorePtr** aPtr)  throw ( SemaphoreException )\
 *Destroys a previously created* **EventSemaphore***.*

### 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 )\

## 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

### 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:**

*aSemCount* Number of semaphores in group \
 *aRightSet* access control for group

**Exceptions:**

*Assertion* if aSemCount \< 1 \
 *SemaphoreException* if kernel group create call fails.

**See also:**

**AccessRights**

### 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:**

*aSemCount* Number of semaphores in group, this only has meaning used if failOnExist = true \
 *aGID* valid group identifier either through a system call or via another ipc mechanism \
 *aRightSet* Specifies access control for group \
 *dist* 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::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:**

*aSemCount* Short Number of semaphores in group, this only has meaning used if failOnExist = true \
 *aName* pointer to Group name \
 *aRightSet* specifies access control for group \
 *disp* 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::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:**

*aName* identifies which semphore id to create or attempt to use \
 *aLimit* maximum number of listeners for **EventSemaphore** \
 *disp* 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::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:**

*aName* identifies which semphore id to create or attempt to use \
 *disp* 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::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:**

*aIdentifier* identifies which semphore id to create or attempt to use \
 *aLimit* maximum number of listeners for **EventSemaphore** \
 *disp* 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::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:**

*aIdentifier* identifies which semphore id to create or attempt to use \
 *disp* 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 \
 *Recursive* allow lock to recurse \
 *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::EventSemaphoreGroup::createSemaphore (Counter aLimit) throw ( SemaphoreException )` [virtual]`

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

*aLimit* maximum number of listeners

**Returns:**

**AbstractSemaphore** aSem - pointer to created semaphore

**Exceptions:**

*SemaphoreException* if no sems left in group

### AbstractSemaphorePtr corelinux::EventSemaphoreGroup::createSemaphore (void) throw ( SemaphoreException )` [virtual]`

Create a default **EventSemaphore**. **Returns:**

**AbstractSemaphore** aSem - pointer to created semaphore

**Exceptions:**

*SemaphoreException* if no sems left in group

Implements **corelinux::SemaphoreGroup**.

### void corelinux::EventSemaphoreGroup::destroySemaphore (AbstractSemaphorePtr aPtr) throw ( SemaphoreException )` [virtual]`

Destroys a previously created **EventSemaphore**. **Parameters:**

*aPtr* pointer of semaphore to destroy

**Exceptions:**

*SemaphoreException* if semaphore does not belong to this group or if already destroyed.

Implements **corelinux::SemaphoreGroup**.

## Author

Generated automatically by Doxygen for CoreLinux++ from the source code.
