nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
include
nixd
Support
AutoRemoveShm.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <boost/interprocess/shared_memory_object.hpp>
4
5
namespace
nixd::util
{
6
7
/// Shared memory object, the object will be removed in dtor.
8
class
AutoRemoveShm
{
9
boost::interprocess::shared_memory_object Shm;
10
std::string ShmName;
11
12
public
:
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
nixd::util::AutoRemoveShm::get
boost::interprocess::shared_memory_object & get()
Definition
AutoRemoveShm.h:19
nixd::util::AutoRemoveShm::~AutoRemoveShm
~AutoRemoveShm()
Definition
AutoRemoveShm.h:15
nixd::util::AutoRemoveShm::AutoRemoveShm
AutoRemoveShm(std::string ShmName, boost::interprocess::offset_t Size)
Definition
AutoRemoveShm.cpp:5
nixd::util::AutoRemoveShm::shmName
const std::string & shmName() const
Definition
AutoRemoveShm.h:17
nixd::util
Definition
AutoCloseFD.h:5
Generated by
1.17.0