IPC@CHIP® RTOS-LNX – API Documentation

Header image

Main page


◆ RTX_NewSem()

RTX_EC RTX_NewSem ( RTX_ID semID,
const char *  name,
int  initvalue 
)

This API creates a new resource or counting semaphore.

A semaphore requires the use of one general purpose kernel object, of which the system has a total of 1000.

CAUTION:

A priority inheritance type semaphore must be used with extreme care. No @CHIP-RTOS-LNX API should be called when a task owns such a semaphore other than RTX_Release_Sem() or RTX_Free_Sem() API. To violate this rule can lead to undefined behavior.
Parameters
semIDOutput parameter: New semaphore ID (handle) will be written here by this API. Caller must provide the memory.
nameUp to 4 character name to give new semaphore. Nil terminator is optional.
initvalueSemaphore initial value. A counting semaphore is created by setting this parameter to a non-negative value. A normal resource type semaphore is created with a -1 (RTX_RESOURCE_SEM_TYPE). A priority inheritance type resource semaphore is created with a -2 (RTX_RESOURCE_SEM_PI_TYPE). A normal resource type semaphore, that can only be used from the current process, is created with a -3 (RTX_RESOURCE_SEM_LOCAL_TYPE). A priority inheritance type resource semaphore, that can only be used from the current process, is created with a -4 (RTX_RESOURCE_SEM_PI_LOCAL_TYPE). The process local resource semaphores produce less overhead.
Compatibility:
Not available in SC1x, SC2x and SC1x3 systems. When source code compatibility is required, the wrapper macro RTX_Create_Sem() should be used. The priority inheritance type resource semaphore (RTX_RESOURCE_SEM_PI_TYPE) is not available in the SC1x, SC2x and SC1x3 C-Library. The process local resource semaphore types are not available at the SC1x, SC2x, SC1x3 and SC2x3 C-Library.
Returns
Zero on success, else an error code.
See also
RTX_Delete_Sem()
Since
V0.80
Changes:
V1.17 - Add process local resource semaphore types.





Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Tue Jul 10 2018 14:54:14 by Doxygen 1.8.13