RTI Connext DDS Micro C API
Version 4.0.1
|
Functions | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_create (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle, RTI_INT32 *status_out, RTI_INT32 key) |
Initializes a shared memory binary semaphore with the provided key and sets up the handle to access it. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_attach (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle, RTI_INT32 *status_out, RTI_INT32 key) |
Attach to an existing shared memory binary semaphore with the provided key and sets up the handle to access it. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_create_or_attach (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle, RTI_INT32 *status_out, RTI_INT32 key) |
Attempts to create a new binary semaphore with the provided key and if the semaphore already exist, attach to it. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_signal (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle, RTI_INT32 *status_out) |
Give the semaphore. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_wait (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle, RTI_INT32 *status_out) |
Take the semaphore. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_detach (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle) |
Detach from the shared memory binary semaphore. | |
RTIBool | OSAPI_SharedMemorySignalingSemaphore_delete (struct OSAPI_SharedMemorySignalingSemaphoreHandle *handle) |
Detach from the shared memory semaphore and deletes it. |
RTIBool OSAPI_SharedMemorySignalingSemaphore_create | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key | ||
) |
Initializes a shared memory binary semaphore with the provided key and sets up the handle to access it.
[in,out] | handle | The shared memory semaphore handle to initialize. |
[out] | status_out | Optional: if not NULL is set to the reason why the call has succeeded or failed. In particular:
|
[in] | key | Key to identify the shared memory semaphore across processes. Other processes should call OSAPI_SharedMemorySignalingSemaphore_attach with the same key to attach to this semaphore. |
RTIBool OSAPI_SharedMemorySignalingSemaphore_attach | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key | ||
) |
Attach to an existing shared memory binary semaphore with the provided key and sets up the handle to access it.
[out] | handle | The shared memory semaphore handle to initialize. |
[out] | status_out | Optional. If not NULL, will be set to:
|
[in] | key | Key to identify the shared memory semaphore across processes. |
RTIBool OSAPI_SharedMemorySignalingSemaphore_create_or_attach | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key | ||
) |
Attempts to create a new binary semaphore with the provided key and if the semaphore already exist, attach to it.
[in,out] | handle | The shared memory semaphore handle to initialize. |
[out] | status_out | Optional: if not NULL is set to the reason why the call has succeeded or failed. In particular:
|
[in] | key | Key to identify the shared memory binary semaphore across processes. |
RTIBool OSAPI_SharedMemorySignalingSemaphore_signal | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle, |
RTI_INT32 * | status_out | ||
) |
Give the semaphore.
[in] | handle | Handle to the semaphore. Must match the one returned by OSAPI_SharedMemorySignalingSemaphore_create |
[out] | status_out | Optional: if not NULL, will be set to:
|
RTIBool OSAPI_SharedMemorySignalingSemaphore_wait | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle, |
RTI_INT32 * | status_out | ||
) |
Take the semaphore.
[in] | handle | Handle to the semaphore. Must match the one returned by OSAPI_SharedMemorySignalingSemaphore_create |
[out] | status_out | Optional: if not NULL, will be set to:
|
RTIBool OSAPI_SharedMemorySignalingSemaphore_detach | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle | ) |
Detach from the shared memory binary semaphore.
[in] | handle | Handle to the shared memory semaphore obtained from OSAPI_SharedMemorySignalingSemaphore_attach |
RTIBool OSAPI_SharedMemorySignalingSemaphore_delete | ( | struct OSAPI_SharedMemorySignalingSemaphoreHandle * | handle | ) |
Detach from the shared memory semaphore and deletes it.
The exact behavior of this may be OS dependent. In some OSs calling this will immediately cause the semaphore to be removed, and other threads waiting on it to be woken up. This is the typical behavior on Unix. In other OSs (windows) this call just requests the semaphore to be removed but delay the removal until all handles are detached.
The only way to ensure the same behavior across multiple OSs is to only call this method on the handle that created the semaphore after all the other handles have been closed. In this scenario no handles will get an error. Alternatively the code could be written to always expect the OSAPI_SharedMemorySignalingSemaphore_wait or OSAPI_SharedMemorySignalingSemaphore_signal call to fail and when that occurs close the handle.
[in] | handle | Handle to the shared memory semaphore obtained from OSAPI_SharedMemorySignalingSemaphore_create |