NUMA++ 0.11.0
Loading...
Searching...
No Matches
memlockExample1.cpp
1#include <iostream>
2#include <numapp/memory.hpp>
3
4int main() {
5 using numapp::operator|;
8 std::cout << "NUMA not available";
9 return -1;
10 }
11
12 // Lock current and future mappings
13 if (auto ec = numapp::MemLockAll(LockAllFlag::Current | LockAllFlag::Future); ec) {
14 std::cerr << "Failed to lock memory!" << std::endl;
15 return -1;
16 }
17}
LockAllFlag
Flags that are combined to modify behaviour of MemLockAll().
Definition memory.hpp:146
std::error_code MemLockAll(LockAllFlag flags) noexcept
Lock all memory pages as specified by provided flags.
Definition memory.cpp:72
bool NumaAvailable() noexcept
Query whether system has NUMA support.
Definition numa.hpp:34
Contains memory function declarations.