179 [[nodiscard]]
const void*
data()
const;
186 [[nodiscard]]
size_t size()
const;
189 std::unique_ptr<struct SysSharememImpl> impl_;
SysSharemem()
Default constructor. The object is not attached until create() or attach() is called.
size_t size() const
Returns the size of the mapped region in bytes.
bool create(const std::string &name, size_t size, Mode mode=kReadWrite)
Creates a new named shared memory region of the given size and maps it.
const void * data() const
Returns a read-only pointer to the beginning of the shared memory region.
~SysSharemem()
Destructor. Calls detach(true) if still attached.
Mode
Access mode for the shared memory mapping.
定义 sys_sharemem.h:100
@ kReadOnly
Read-only mapping (PROT_READ)
定义 sys_sharemem.h:101
@ kReadWrite
Read-write mapping (PROT_READ | PROT_WRITE)
定义 sys_sharemem.h:102
bool attach(const std::string &name, Mode mode=kReadWrite)
Attaches to an existing named shared memory region.
bool detach(bool force=true)
Unmaps the shared memory region and optionally unlinks the OS object.
void * data()
Returns a writable pointer to the beginning of the shared memory region.
bool is_attached() const
Returns true if the region is currently mapped.
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
定义 macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
定义 macros.h:184