RTEMS Logo

RTEMS 4.9.1 On-Line Library


Semaphore Manager SEMAPHORE_CREATE - Create a semaphore

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

9.4.1: SEMAPHORE_CREATE - Create a semaphore

CALLING SEQUENCE:

procedure Semaphore_Create (
   Name             : in     RTEMS.Name;
   Count            : in     RTEMS.Unsigned32;
   Attribute_Set    : in     RTEMS.Attribute;
   Priority_Ceiling : in     RTEMS.Task_Priority;
   ID               :    out RTEMS.ID;
   Result           :    out RTEMS.Status_Codes
);

DIRECTIVE STATUS CODES:

RTEMS.SUCCESSFUL - semaphore created successfully
RTEMS.INVALID_NAME - invalid semaphore name
RTEMS.INVALID_ADDRESS - id is NULL
RTEMS.TOO_MANY - too many semaphores created
RTEMS.NOT_DEFINED - invalid attribute set
RTEMS.INVALID_NUMBER - invalid starting count for binary semaphore
RTEMS.MP_NOT_CONFIGURED - multiprocessing not configured
RTEMS.TOO_MANY - too many global objects

DESCRIPTION:

This directive creates a semaphore which resides on the local node. The created semaphore has the user-defined name specified in name and the initial count specified in count. For control and maintenance of the semaphore, RTEMS allocates and initializes a SMCB. The RTEMS-assigned semaphore id is returned in id. This semaphore id is used with other semaphore related directives to access the semaphore.

Specifying PRIORITY in attribute_set causes tasks waiting for a semaphore to be serviced according to task priority. When FIFO is selected, tasks are serviced in First In-First Out order.

NOTES:

This directive will not cause the calling task to be preempted.

The priority inheritance and priority ceiling algorithms are only supported for local, binary semaphores that use the priority task wait queue blocking discipline.

The following semaphore attribute constants are defined by RTEMS:

Semaphores should not be made global unless remote tasks must interact with the created semaphore. This is to avoid the system overhead incurred by the creation of a global semaphore. When a global semaphore is created, the semaphore's name and id must be transmitted to every node in the system for insertion in the local copy of the global object table.

The total number of global objects, including semaphores, is limited by the maximum_global_objects field in the Configuration Table.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation