Holds a reference to a mapped shared memory region and all the information used to create/open it. Such shared memory region can be shared with other processes on the same system using a communication mechanism such as via unix domain sockets, win32 DuplicateHandle, or if names are used, transferring the names to the processes and opening them (.
More...
#include <shm.h>
|
| static bool | create (SharedMemoryInfo &info, size_t size, const char *name=nullptr, int numa_node=-1) |
| | Creates a shared memory region accessible via handle.
|
| |
| static bool | open (SharedMemoryInfo &info, const std::string &name, size_t size) |
| | Opens a previously created shared memory region given it's name and size.
|
| |
| static bool | open (SharedMemoryInfo &info, OsHandle handle, size_t size) |
| | Opens a previously created shared memory region given it's associated handle and size.
|
| |
Holds a reference to a mapped shared memory region and all the information used to create/open it. Such shared memory region can be shared with other processes on the same system using a communication mechanism such as via unix domain sockets, win32 DuplicateHandle, or if names are used, transferring the names to the processes and opening them (.
- See also
- SharedMemoryInfo::open)
◆ SharedMemoryInfo() [1/3]
| Realm::SharedMemoryInfo::SharedMemoryInfo |
( |
void |
| ) |
|
◆ SharedMemoryInfo() [2/3]
◆ ~SharedMemoryInfo()
| Realm::SharedMemoryInfo::~SharedMemoryInfo |
( |
void |
| ) |
|
On destruction, the SharedMemoryInfo will unmap the memory associated with this shared region, if any, and unlink it from the file system if it owns it.
◆ SharedMemoryInfo() [3/3]
◆ create()
| static bool Realm::SharedMemoryInfo::create |
( |
SharedMemoryInfo & |
info, |
|
|
size_t |
size, |
|
|
const char * |
name = nullptr, |
|
|
int |
numa_node = -1 |
|
) |
| |
|
static |
Creates a shared memory region accessible via handle.
- Note
- It is preferred that the name is null here as this creates an anonymous backing store that requires processor-to-processor communication.
- Parameters
-
| [out] | info | Shared memory object containing the base pointer and size |
| name | Name associated with the shared memory allocation, passed to |
- See also
- SharedMemoryInfo::open in another process.
- Parameters
-
| size | Size of the shared memory region to allocate |
| numa_node | NUMA node to allocate the pages on |
- Returns
- True on success, false otherwise
◆ get_handle()
| OsHandle Realm::SharedMemoryInfo::get_handle |
( |
| ) |
const |
|
inline |
◆ get_name()
| std::string Realm::SharedMemoryInfo::get_name |
( |
| ) |
const |
|
inline |
◆ get_ptr()
template<typename T >
| T * Realm::SharedMemoryInfo::get_ptr |
( |
| ) |
const |
|
inline |
◆ get_size()
| size_t Realm::SharedMemoryInfo::get_size |
( |
| ) |
const |
|
inline |
◆ open() [1/2]
| static bool Realm::SharedMemoryInfo::open |
( |
SharedMemoryInfo & |
info, |
|
|
const std::string & |
name, |
|
|
size_t |
size |
|
) |
| |
|
static |
Opens a previously created shared memory region given it's name and size.
- Parameters
-
| [out] | info | Shared memory object containing the base pointer and size |
| name | Name of the shared memory region (to be retrieved from |
- See also
- SharedMemoryInfo::create in another process)
- Parameters
-
| size | Size of the shared memory region to allocate |
- Returns
- True on success, false otherwise
◆ open() [2/2]
Opens a previously created shared memory region given it's associated handle and size.
- See also
- Realm::close_handle
- Parameters
-
| [out] | info | |
| handle | OS handle of the associated memory object (retrieved from |
- See also
- SharedMemoryInfo::create)
- Parameters
-
| size | Size of the shared memory region to allocate |
- Returns
- True on success, false otherwise
◆ operator bool()
| Realm::SharedMemoryInfo::operator bool |
( |
| ) |
const |
|
inlineexplicit |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ unlink()
| void Realm::SharedMemoryInfo::unlink |
( |
void |
| ) |
|
Removes the name from the shared memory region such that it can't be opened by it's name any more and closes the associated handle.
- Note
- not applicable to windows
The documentation for this class was generated from the following file:
- /home/runner/work/realm/realm/realm-src/src/realm/shm.h