24 lines
457 B
C++
24 lines
457 B
C++
#pragma once
|
|
#ifndef MESSMER_CPPUTILS_SYSTEM_MEMORY_H
|
|
#define MESSMER_CPPUTILS_SYSTEM_MEMORY_H
|
|
|
|
#include <cstdlib>
|
|
|
|
namespace cpputils {
|
|
|
|
// While this RAII object exists, it locks a given memory address into RAM,
|
|
// i.e. tells the operating system not to swap it.
|
|
class DontSwapMemoryRAII final {
|
|
public:
|
|
DontSwapMemoryRAII(const void* addr, size_t len);
|
|
~DontSwapMemoryRAII();
|
|
|
|
private:
|
|
const void* addr_;
|
|
const size_t len_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|