RTI Connext Micro C API Version 4.2.0
|
Allow access to a shared memory segment (memory block) so that multiple processes can read-and write a common memory area. More...
Data Structures | |
struct | NETIO_SharedMemorySegmentHeader |
Functions | |
RTIBool | NETIO_SharedMemorySegment_create_or_attach (struct NETIO_SharedMemorySegmentHandle *handle, RTI_INT32 *status_out, RTI_INT32 key, RTI_UINT32 size, OSAPI_ProcessId pid_in) |
Attempts to create a new shared memory segment. If the segment already exists and the creator process is dead, attach and recycle it. | |
RTIBool | NETIO_SharedMemorySegment_create (struct NETIO_SharedMemorySegmentHandle *handle, RTI_INT32 *status_out, RTI_INT32 key, RTI_UINT32 size, OSAPI_ProcessId pid_in) |
Creates a new shared memory segment with the provided key and returns the handle to access it. | |
RTIBool | NETIO_SharedMemorySegment_delete (struct NETIO_SharedMemorySegmentHandle *handle) |
deletes the shared memory segment previously create with NETIO_SharedMemorySegment_create. If the segment is still attached, it is detached first. | |
RTIBool | NETIO_SharedMemorySegment_attach (struct NETIO_SharedMemorySegmentHandle *handle, RTI_INT32 *status_out, RTI_INT32 key) |
Attach to the shared memory previously initialized with NETIO_SharedMemorySegment_create_or_attach and returns a handle to it. | |
RTIBool | NETIO_SharedMemorySegment_detach (struct NETIO_SharedMemorySegmentHandle *handle) |
Detach from the shared memory previously created with NETIO_SharedMemorySegment_attach. | |
char * | NETIO_SharedMemorySegment_get_address (struct NETIO_SharedMemorySegmentHandle *handle) |
Get the address of the shared memory attached by the handle. | |
NETIOPSLDllExport RTI_INT32 | NETIO_SharedMemorySegment_get_size (struct NETIO_SharedMemorySegmentHandle *handle) |
Get the size (available for user data) of the shared memory segment. | |
NETIOPSLDllExport RTI_UINT32 | NETIO_SharedMemorySegment_get_max_size (void) |
Maximum allowable size of a shared memory segment. | |
Allow access to a shared memory segment (memory block) so that multiple processes can read-and write a common memory area.
RTIBool NETIO_SharedMemorySegment_create_or_attach | ( | struct NETIO_SharedMemorySegmentHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key, | ||
RTI_UINT32 | size, | ||
OSAPI_ProcessId | pid_in ) |
Attempts to create a new shared memory segment. If the segment already exists and the creator process is dead, attach and recycle it.
[in,out] | handle | The shared memory segment 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 segment Across processes. Other processes should call NETIO_SharedMemorySegment_attach with the same key to attach to this segment. |
[in] | size | Size of memory to be initialized. |
[in] | pid_in | PID of the process that calls this method. |
References RTI_INT32, and RTI_UINT32.
RTIBool NETIO_SharedMemorySegment_create | ( | struct NETIO_SharedMemorySegmentHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key, | ||
RTI_UINT32 | size, | ||
OSAPI_ProcessId | pid_in ) |
Creates a new shared memory segment with the provided key and returns the handle to access it.
[in,out] | handle | The shared memory segment 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 segment across processes. Other processes should call NETIO_SharedMemorySegment_attach with the same key to attach to this segment. |
[in] | size | Size of memory to be initialized. |
[in] | pid_in | PID of the process that calls this method. |
References RTI_INT32, and RTI_UINT32.
RTIBool NETIO_SharedMemorySegment_delete | ( | struct NETIO_SharedMemorySegmentHandle * | handle | ) |
deletes the shared memory segment previously create with NETIO_SharedMemorySegment_create. If the segment is still attached, it is detached first.
[in] | handle | The shared memory segment handle identifying the segment to detach |
Once called this function (even if it returns RTI_FALSE) you cannot use anymore this shared memory segment.
RTIBool NETIO_SharedMemorySegment_attach | ( | struct NETIO_SharedMemorySegmentHandle * | handle, |
RTI_INT32 * | status_out, | ||
RTI_INT32 | key ) |
Attach to the shared memory previously initialized with NETIO_SharedMemorySegment_create_or_attach and returns a handle to it.
[in,out] | handle | The shared memory segment handle to initialize. |
[out] | status_out | Optional. If not NULL, will be set to:
|
[in] | key | Key to identify the shared memory segment across processes. Must match that used by other processes calling NETIO_SharedMemorySegment_create_or_attach or NETIO_SharedMemorySegment_attach(). |
References RTI_INT32.
RTIBool NETIO_SharedMemorySegment_detach | ( | struct NETIO_SharedMemorySegmentHandle * | handle | ) |
Detach from the shared memory previously created with NETIO_SharedMemorySegment_attach.
[in] | handle | The shared memory segment handle identifying the segment to detach |
The shared memory segment is always detached. Once the precondition is met, no errors will be generated.
Once called this function (even if it returns RTI_FALSE) you cannot use anymore this shared memory segment, except for destroying it.
char * NETIO_SharedMemorySegment_get_address | ( | struct NETIO_SharedMemorySegmentHandle * | handle | ) |
Get the address of the shared memory attached by the handle.
[in] | handle | Handle to the shared memory segment obtained from an NETIO_SharedMemorySegment_attach or a NETIO_SharedMemorySegment_create_or_attach |
References RTI_INT32.
NETIOPSLDllExport RTI_INT32 NETIO_SharedMemorySegment_get_size | ( | struct NETIO_SharedMemorySegmentHandle * | handle | ) |
Get the size (available for user data) of the shared memory segment.
This size will match the one passed to the NETIO_SharedMemorySegment_create_or_attach call
[in] | handle | Handle to the shared memory segment obtained from an NETIO_SharedMemorySegment_attach or a NETIO_SharedMemorySegment_create_or_attach call. |
References RTI_UINT32.
NETIOPSLDllExport RTI_UINT32 NETIO_SharedMemorySegment_get_max_size | ( | void | ) |
Maximum allowable size of a shared memory segment.
References RTI_INT32.