nixd
Loading...
Searching...
No Matches
AutoRemoveShm.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/interprocess/shared_memory_object.hpp>
4
5namespace nixd::util {
6
7/// Shared memory object, the object will be removed in dtor.
9 boost::interprocess::shared_memory_object Shm;
10 std::string ShmName;
11
12public:
13 AutoRemoveShm(std::string ShmName, boost::interprocess::offset_t Size);
14
15 ~AutoRemoveShm() { Shm.remove(ShmName.c_str()); }
16
17 [[nodiscard]] const std::string &shmName() const { return ShmName; }
18
19 boost::interprocess::shared_memory_object &get() { return Shm; }
20};
21
22} // namespace nixd::util
Shared memory object, the object will be removed in dtor.
boost::interprocess::shared_memory_object & get()
AutoRemoveShm(std::string ShmName, boost::interprocess::offset_t Size)
const std::string & shmName() const