IPC@CHIP® RTOS-LNX – API Documentation

Header image

Main page


RTOS Semaphore Services

Using a counting semaphore:

A counting semaphore is created by specifying an initial count greater or equal to zero in the call to RTX_NewSem(). If a semaphore is initialized with a value n, it can be used to control access to n resources, e.g. a counting semaphore with the initial value three assures that no more than three tasks can own a resource at any one time. Access to a resource controlled by a counting semaphore is acquired with a call to RTX_Get_Sem(), RTX_Sem_Wait(), RTX_Sem_Timeout() RTX_Wait_Sem_Priority() API. If the resource is available the @CHIP-RTOS-LNX gives it to the task immediately. When the task is finished using the resource, it may signal its release by calling RTX_Signal_Sem().

Using a resource semaphore:

The system provides two types of resource semaphores:

A normal resource type semaphore is created with a -1 (RTX_RESOURCE_SEM_TYPE) and a priority inheritance type resource semaphore is created with a -2 (RTX_RESOURCE_SEM_PI_TYPE) for the initial count in the call of RTX_NewSem(). The API creates a resource semaphore and automatically gives it an initial value of one indicating that the resource is free. A resource is reserved by calling RTX_Get_Sem(), RTX_Sem_Wait(), RTX_Sem_Timeout() RTX_Wait_Sem_Priority() API with the semaphore ID returned by RTX_NewSem(). The resource is released with a call to either RTX_Release_Sem() or RTX_Free_Sem().

Semaphore Services:

— Resource Semaphore API -—

— Counting Semaphore API -—






Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Fri Feb 9 2018 17:44:49 by Doxygen 1.8.13