ladivic
|
Provides utilities for Inter-Process Communication (IPC) using shared memory. More...
Go to the source code of this file.
Functions | |
template<typename T > | |
i32 | ldvc_create_ipc (std::mutex &mtx, string path) |
Creates a new IPC shared memory segment. | |
template<typename T > | |
T * | ldvc_attach_ipc (i32 shmid, std::mutex &mtx) |
Attaches to an existing IPC shared memory segment. | |
template<typename T > | |
u8 | ldvc_detach_ipc (T *data, std::mutex &mtx) |
Detaches from an IPC shared memory segment. | |
template<typename T > | |
bool | ldvc_destroy_ipc (i32 shmid, std::mutex &mtx) |
Destroys an IPC shared memory segment. | |
Provides utilities for Inter-Process Communication (IPC) using shared memory.
This header file contains a set of functions for managing shared memory segments to facilitate inter-process communication (IPC). These functions enable the creation, attachment, detachment, and destruction of shared memory segments, ensuring thread safety during these operations.
Definition in file ldvc_ipc.hpp.
T * ldvc_attach_ipc | ( | i32 | shmid, |
std::mutex & | mtx ) |
Attaches to an existing IPC shared memory segment.
This function attaches to an existing IPC shared memory segment specified by its identifier (shmid).
T | The type of data stored in the shared memory segment. |
shmid | The identifier of the shared memory segment to attach to. |
mtx | A mutex used to ensure thread safety during the attachment process. |
Definition at line 86 of file ldvc_ipc.hpp.
i32 ldvc_create_ipc | ( | std::mutex & | mtx, |
string | path ) |
Creates a new IPC shared memory segment.
This function creates a new IPC shared memory segment with the specified size and a unique key derived from the provided path.
T | The type of data to be stored in the shared memory segment. |
mtx | A mutex used to ensure thread safety during the creation process. |
path | The path used to generate the unique key for the shared memory segment. |
Definition at line 59 of file ldvc_ipc.hpp.
bool ldvc_destroy_ipc | ( | i32 | shmid, |
std::mutex & | mtx ) |
Destroys an IPC shared memory segment.
This function destroys an IPC shared memory segment specified by its identifier (shmid).
T | The type of data stored in the shared memory segment. |
shmid | The identifier of the shared memory segment to destroy. |
mtx | A mutex used to ensure thread safety during the destruction process. |
Definition at line 138 of file ldvc_ipc.hpp.
u8 ldvc_detach_ipc | ( | T * | data, |
std::mutex & | mtx ) |
Detaches from an IPC shared memory segment.
This function detaches from an IPC shared memory segment given a pointer to the shared memory region.
T | The type of data stored in the shared memory segment. |
data | A pointer to the shared memory region. |
mtx | A mutex used to ensure thread safety during the detachment process. |
Definition at line 113 of file ldvc_ipc.hpp.