@CHIP-RTOS C Library - RTOS API
RTX_Reserve_Sem
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
with success. int RTX_Reserve_Sem ( int semID, long far *time_ms ); Parameters
semID
- The semaphore ID of a resource semaphore
acquired by a call to RTX_Create_Sem.
time_ms
- 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
indication.
Return Value
- 0 on success else
error code.
Comments
- The calling task will be suspended waiting for the resource if the
resource 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
even
if the calling task already owns the resource. The resource usage count
is incremented by one for each subsequent call by the resource owner.
The wait priority used here is 20. (See the
RTX_Wait_Sem_Priority
alternative API for explanation of wait priority.)
See Also
RTOS API
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
documentation
for more details.
Related Topics
-
- RTX API Overview
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| V1.00 | V1.00 | V1.00 | V0.90 | V1.00 |
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|