1.4.4.3 OSAL_SEM_Pend Function
1.4.4.3 C
OSAL_RESULT OSAL_SEM_Pend(OSAL_SEM_HANDLE_TYPE* semID, uint16_t waitMS)
1.4.4.3 Summary
Waits on a semaphore. Returns true if the semaphore was obtained within the time limit.
1.4.4.3 Description
This function is a blocking function call that waits (i.e., pends) on a semaphore. The function will return true if the semaphore has been obtained, or false if it was not available or the time limit was exceeded.
1.4.4.3 Precondition
Semaphore must have been created.
1.4.4.3 Parameters
| Parameters | Description |
|---|---|
| semID | Pointer to the Semaphore ID |
| waitMS | Time limit to wait in milliseconds:
|
1.4.4.3 Returns
OSAL_RESULT_TRUE - Semaphore obtained.
OSAL_RESULT_FALSE - Semaphore not obtained or time-out occurred.
1.4.4.3 Example
if (OSAL_SEM_Pend(&semUARTRX, 50) == OSAL_RESULT_TRUE)
{
// character available
c = DRV_USART_ReadByte(drvID);
...
}
else
{
// character not available, resend prompt
...
}
1.4.4.3 Remarks
None.
