||const char *
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.
- 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.
|semID||Output parameter: New semaphore ID (handle) will be written here by this API. Caller must provide the memory. |
|name||Up to 4 character name to give new semaphore. Nil terminator is optional. |
|initvalue||Semaphore 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. |
- 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.
- Zero on success, else an error code.
- See also
- V1.17 - Add process local resource semaphore types.