NUMA++ 0.11.0
Loading...
Searching...
No Matches
numapp::ScopedMemPolicy Class Reference

Applies memory policy to this thread at construction and reverts to previous at destruction. More...

#include <mempolicy.hpp>

Public Member Functions

 ScopedMemPolicy (MemPolicy const &new_policy)
 Constructs an object that applies the provided policy during construction and restores it during destruction.
 
 ~ScopedMemPolicy () noexcept
 Restores old policy, if any.
 
 ScopedMemPolicy () noexcept=default
 Initialized a scoped memory policy that does nothing and holds no state about previous policy.
 
void Swap (ScopedMemPolicy &rhs) noexcept
 Swap state with another ScopedMemPolicy.
 
std::error_code Restore () noexcept
 Restores memory policy that was read during construction.
 

Detailed Description

Applies memory policy to this thread at construction and reverts to previous at destruction.

See also
numapp::MemPolicy

Definition at line 383 of file mempolicy.hpp.

Constructor & Destructor Documentation

◆ ScopedMemPolicy()

numapp::ScopedMemPolicy::ScopedMemPolicy ( MemPolicy const & new_policy)
inlineexplicit

Constructs an object that applies the provided policy during construction and restores it during destruction.

Exceptions
std::system_errorcontaining the error code if it fails to apply new policy. Attempt to restore old policy will be done.

Definition at line 392 of file mempolicy.hpp.

Member Function Documentation

◆ Restore()

std::error_code numapp::ScopedMemPolicy::Restore ( )
nodiscardnoexcept

Restores memory policy that was read during construction.

Returns
the error that caused it to fail to apply old policy.

The documentation for this class was generated from the following file: