Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > ARINC 653 for PikeOS 653 code > ARINC 653 for PikeOS 653 profile items > Semaphore (ARINC for PikeOS code)
  
Semaphore (ARINC for PikeOS code)
A Semaphore is used to limit the number of processes within a partition that can simultaneously access a resource. Semaphores must therefore always be scoped to partitions. The limit is often one, but ARINC 653 Semaphores are counting semaphores so it can be more. For more information see the ARINC SPECIFICATION 653P1-2, December 1, 2005.
A Semaphore is created in the application startup code that is generated for each of the Partition Part's Application Parts. For example, using C:
/* Header File */
#include <apex_semaphores.h>
...
extern SEMAPHORE_ID_TYPE Semaphore1_id;

/* Implementation File */
SEMAPHORE_ID_TYPE Semaphore1_id;
...
CREATE_SEMAPHORE("Semaphore1", 64,128, FIFO, &Semaphore1_id, &rc);
ASSERT(rc == NO_ERROR);
Create a Semaphore on a Configuration Diagram: click the Semaphore toolbar button, and then click within a Partition Part.
To set the QueuingDiscipline, CurrentValue and MaxValue properties of the Semaphore: right-click the Semaphore, point to ARINC 653, point to Set, and then click the command associated with the property you want to set.
When shown on a Configuration Diagram, a Semaphore's notation is as follows:
You can view all the Semaphores in the model through the Semaphore folder in the ARINC 653 Profile pane.
A Semaphore is based on a UML Attribute.
The following sections provide information about how a Semaphore is used in the model.
Shown on these diagrams
Configuration Diagram
ARINC properties
CurrentValue - generated as the current value of the semaphore in the application startup code. To set this property: right-click the Semaphore, point to ARINC 653, point to Set, and then click CurrentValue.
QueuingDiscipline - generated as the queuing discipline of the semaphore in the application startup code. To set this property: right-click the Semaphore, point to ARINC 653, point to Set, and then click QueuingDiscipline. Possible values are FIFO or PRIORITY.
MaxValue - generated as the maximum value of the semaphore in the application startup code. To set this property: right-click the Semaphore, point to ARINC 653, point to Set, and then click MaxValue.