RTI Connext DDS Micro C++ API
Version 4.1.0
|
Functions | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_create (struct NETIO_SharedMemoryMutexHandle *handle, RTI_INT32 *status_out, RTI_INT32 key) |
Create a shared memory mutex. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_attach (struct NETIO_SharedMemoryMutexHandle *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. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_create_or_attach (struct NETIO_SharedMemoryMutexHandle *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. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_unlock (struct NETIO_SharedMemoryMutexHandle *handle, RTI_INT32 *status_out) |
Give the semaphore. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_lock (struct NETIO_SharedMemoryMutexHandle *handle, RTI_INT32 *status_out) |
Take the semaphore. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_detach (struct NETIO_SharedMemoryMutexHandle *handle) |
Detach from the shared memory binary semaphore. | |
NETIO_SHMEMDllExport RTIBool | NETIO_SharedMemoryMutex_delete (struct NETIO_SharedMemoryMutexHandle *handle) |
Detach from the shared memory semaphore and deletes it. |
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_create | ( | struct NETIO_SharedMemoryMutexHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key | ||
) |
Create a shared memory mutex.
handle | out Pointer to handle on successful return |
status_out | out. Optional: if not NULL is set to the reason why the call has succeeded or failed. In particular:
|
key | in. Key to identify the shared memory semaphore across processes. |
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_attach | ( | struct NETIO_SharedMemoryMutexHandle * | 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.
handle | out. The shared memory semaphore handle to initialize. |
status_out | out. Optional. If not NULL, will be set to:
|
key | in. Key to identify the shared memory semaphore across processes. |
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_create_or_attach | ( | struct NETIO_SharedMemoryMutexHandle * | 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.
handle | inOut. The shared memory semaphore handle to initialize. |
status_out | out. Optional: if not NULL is set to the reason why the call has succeeded or failed. In particular:
|
key | in. Key to identify the shared memory binary semaphore across processes. |
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_unlock | ( | struct NETIO_SharedMemoryMutexHandle * | handle, |
RTI_INT32 * | status_out | ||
) |
Give the semaphore.
handle | in. Handle to the semaphore. Must match the one returned by NETIO_SharedMemoryMutex_create |
status_out | out. Optional: if not NULL, will be set to:
|
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_lock | ( | struct NETIO_SharedMemoryMutexHandle * | handle, |
RTI_INT32 * | status_out | ||
) |
Take the semaphore.
handle | in. Handle to the semaphore. Must match the one returned by NETIO_SharedMemoryMutex_create |
status_out | out. Optional: if not NULL, will be set to:
|
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_detach | ( | struct NETIO_SharedMemoryMutexHandle * | handle | ) |
Detach from the shared memory binary semaphore.
handle | in handle. Handle to the shared memory semaphore obtained from NETIO_SharedMemoryMutex_attach |
NETIO_SHMEMDllExport RTIBool NETIO_SharedMemoryMutex_delete | ( | struct NETIO_SharedMemoryMutexHandle * | 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 NETIO_SharedMemorySignalingSemaphore_wait or NETIO_SharedMemorySignalingSemaphore_signal call to fail and when that occurs close the handle.
handle | in handle. Handle to the shared memory semaphore obtained from NETIO_SharedMemoryMutex_create |