---
name: "corelinux_GatewaySemaphoreGroup"
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_GatewaySemaphoreGroup"
---

# corelinux\_GatewaySemaphoreGroup(3)

A GatewaySemaphoreGroup is an extension to the SemaphoreGroup for creating only GatewaySemaphore types.

## NAME

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

## SYNOPSIS

`#include <GatewaySemaphoreGroup.hpp>`

Inherits **corelinux::SemaphoreGroup**.

### Public Member Functions

**GatewaySemaphoreGroup** (Short, Int Rights=OWNER\_ALL)  throw (Assertion,SemaphoreException)\
 *Default constructor creates a private group semaphores with access for OWNER\_ALL.*  **GatewaySemaphoreGroup** (Short, **SemaphoreGroupIdentifierCref**, Int, **CreateDisposition** disp=FAIL\_IF\_EXISTS)  throw (Assertion,SemaphoreException)\
 *Constructor to open or create a semaphore group with a specific identifier.*  **GatewaySemaphoreGroup** (Short, CharCptr aName, Int, **CreateDisposition** disp=FAIL\_IF\_EXISTS)  throw (Assertion,SemaphoreException)\
 *Constructor to open or create a semaphore group by name.*  virtual **~GatewaySemaphoreGroup** (void)\
 *Virtual destructor.*  virtual **AbstractSemaphorePtr** **createSemaphore** (void)  throw ( SemaphoreException )\
 *Create a default* **GatewaySemaphore***.*  virtual **AbstractSemaphorePtr** **createCountSemaphore** (Count aCount)  throw ( SemaphoreException )\
 *Create a count* **GatewaySemaphore***.*  virtual **AbstractSemaphorePtr** **createSemaphore** (**SemaphoreIdentifierRef** aIdentifier, **CreateDisposition** disp=CREATE\_OR\_REUSE, bool Recursive=false, bool Balking=false)  throw ( SemaphoreException )\
 *Create or open (use) a specific GatewaySemphore.*  virtual **AbstractSemaphorePtr** **createCountSemaphore** (**SemaphoreIdentifierRef** aIdentifier, Count aCount, **CreateDisposition** disp=CREATE\_OR\_REUSE, bool Recursive=false, bool Balking=false)  throw ( SemaphoreException )\
 *Create or open (use) a specific GatewaySemphore and have it automatically initialized 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 GatewaySemphore.*  virtual void **destroySemaphore** (**AbstractSemaphorePtr**)  throw ( SemaphoreException )\
 *Destroys a created* **GatewaySemaphore***.*

### Protected Member Functions

**GatewaySemaphoreGroup** (void)  throw ( Assertion )\
 *Default constructor not allowed.*  **GatewaySemaphoreGroup** (**GatewaySemaphoreGroupCref**)  throw ( Assertion )\
 *Copy constructor not allowed.*  **GatewaySemaphoreGroupRef** **operator=** (**GatewaySemaphoreGroupCref**)  throw ( Assertion )\
 *Assignment operator not allowed.*  **AbstractSemaphorePtr** **resolveSemaphore** (**SemaphoreIdentifierRef** aIdentifier, Short aSemId, **CreateDisposition** aDisp, bool aRecurse, bool aBalk, Count aMaxValue=1)  throw ( SemaphoreException )\
 *Protected method for resolving mutex between CSA and local.*

## Detailed Description

A **GatewaySemaphoreGroup** is an extension to the **SemaphoreGroup** for creating only **GatewaySemaphore** types.

Default behavior for creating semaphores via the **SemaphoreGroup** interface is to create a Gateway and initialize it to a count of two (2) Use the createCountSemaphore(...) interface to accomplish initializing the **GatewaySemaphore** to a count \> 2.

## Constructor & Destructor Documentation

### corelinux::GatewaySemaphoreGroup::GatewaySemaphoreGroup (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::GatewaySemaphoreGroup::GatewaySemaphoreGroup (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::GatewaySemaphoreGroup::GatewaySemaphoreGroup (Short, CharCptr aName, 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::GatewaySemaphoreGroup::createCountSemaphore (SemaphoreIdentifierRef aIdentifier, Count aCount, CreateDisposition disp = CREATE\_OR\_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException )` [virtual]`

Create or open (use) a specific GatewaySemphore and have it automatically initialized to the specified count. **Parameters:**

*SemaphoreIdentifier* identifies which semphore id to create or attempt to use \
 *Count* initializing count for **GatewaySemaphore** \
 *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::GatewaySemaphoreGroup::createCountSemaphore (Count aCount) throw ( SemaphoreException )` [virtual]`

Create a count **GatewaySemaphore**. **Parameters:**

*Count* initializing count for **GatewaySemaphore**

**Returns:**

**AbstractSemaphore** aSem - pointer to created semaphore

**Exceptions:**

*SemaphoreException* if no sems left in group

### AbstractSemaphorePtr corelinux::GatewaySemaphoreGroup::createSemaphore (std::string aName, CreateDisposition disp = CREATE\_OR\_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException )` [virtual]`

Create or open (use) a specific GatewaySemphore. **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::GatewaySemaphoreGroup::createSemaphore (SemaphoreIdentifierRef aIdentifier, CreateDisposition disp = CREATE\_OR\_REUSE, bool Recursive = false, bool Balking = false) throw ( SemaphoreException )` [virtual]`

Create or open (use) a specific GatewaySemphore. **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::GatewaySemaphoreGroup::createSemaphore (void) throw ( SemaphoreException )` [virtual]`

Create a default **GatewaySemaphore**. **Returns:**

**AbstractSemaphore** aSem - pointer to created semaphore

**Exceptions:**

*SemaphoreException* if no sems left in group

Implements **corelinux::SemaphoreGroup**.

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

Destroys a created **GatewaySemaphore**. **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**.

## Author

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