RTI Connext Cert C API
Version 2.4.15
|
Abstract Semaphore API. More...
Typedefs | |
typedef struct OSAPI_Semaphore | OSAPI_Semaphore_T |
The abstract semaphore type. |
Functions | |
OSAPI_Semaphore_T * | OSAPI_Semaphore_new (void) |
Create a Semaphore. | |
RTI_BOOL | OSAPI_Semaphore_take (OSAPI_Semaphore_T *self, RTI_INT32 timeout, RTI_INT32 *fail_reason) |
Take a semaphore. | |
RTI_BOOL | OSAPI_Semaphore_give (OSAPI_Semaphore_T *self) |
Give a semaphore. |
Abstract Semaphore API.
typedef struct OSAPI_Semaphore OSAPI_Semaphore_T |
The abstract semaphore type.
OSAPI_Semaphore_T* OSAPI_Semaphore_new | ( | void | ) |
Create a Semaphore.
The created semaphore is a binary semaphore with an initial semaphore value set to 0 and a maximum value of 1. Thus, a call to OSAPI_Semaphore_take will block until the semaphore is signaled with a call to OSAPI_Semaphore_give.
RTI_BOOL OSAPI_Semaphore_take | ( | OSAPI_Semaphore_T * | self, |
RTI_INT32 | timeout, | ||
RTI_INT32 * | fail_reason | ||
) |
Take a semaphore.
self | <<in>> A semaphore previously created with OSAPI_Semaphore_new. |
timeout | <<in>> The timeout in ms. The take call will wait at most timeout ms before returning. If OSAPI_SEMAPHORE_TIMEOUT_INFINITE is specified, the call will not return until the semaphore has a value of 1 or higher. |
fail_reason | <<out>> Additional information when the call returns. If RTI_TRUE is returned, but timed out, fail_reason is set to OSAPI_SEMAPHORE_RESULT_TIMEOUT, otherwise fail_reason is set to OSAPI_SEMAPHORE_RESULT_OK. If RTI_FALSE is returned, fail_reason is set toOSAPI_SEMAPHORE_RESULT_ERROR. |
RTI_BOOL OSAPI_Semaphore_give | ( | OSAPI_Semaphore_T * | self | ) |
Give a semaphore.
A mutex can only be given if it is owned by the calling thread. The mutex must be given as many times as it has been taken.
self | <<in>> The semaphore previously created with OSAPI_Semaphore_new. |