@CHIP-RTOS C Library - RTOS API
Reserve a resource semaphore. If current task
is already the owner of this semaphore then the semaphore's usage
count is incremented by one and the function returns immediately
int RTX_Reserve_Sem ( int semID, long far *time_ms );
- The semaphore ID of a resource semaphore
acquired by a call to RTX_Create_Sem.
- Pointer for ms to wait: Zero -> Wait forever for semaphore
Positive value -> Maximum number of milliseconds to wait for resource
Negative value -> Polling mode, return immediately. If semaphore
was not available the return value will be the -27 time-out
- 0 on success else
- The calling task will be suspended to wait for the resource if the
semaphore is owned by some other task.
When the resource is finally available for use by the caller, the
procedure will return with 0.
Upon first acquiring ownership of the resource, the resouce's usage count
is set to one.
It is permissible for a task to call RTX_Reserve_Sem
if the calling task already owns the resource. The resource usage count
is incremented by one for each subsequent call by the resource owner.
This usage count is down counted by
RTX_Release_Sem and cleared by
RTX_Free_Sem. When the count
reaches zero the task no longer owns the semaphore.
The wait priority used here is 20. (See the
alternative API for explanation of wait priority.)
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
for more details.
- RTX API Overview
Supported since or modified in @CHIP-RTOS version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document